@aws-sdk/middleware-sdk-s3 3.470.0 → 3.474.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,16 +4,16 @@ exports.getRegionRedirectMiddlewarePlugin = exports.regionRedirectMiddlewareOpti
|
|
|
4
4
|
const region_redirect_endpoint_middleware_1 = require("./region-redirect-endpoint-middleware");
|
|
5
5
|
function regionRedirectMiddleware(clientConfig) {
|
|
6
6
|
return (next, context) => async (args) => {
|
|
7
|
-
var _a;
|
|
7
|
+
var _a, _b;
|
|
8
8
|
try {
|
|
9
9
|
return await next(args);
|
|
10
10
|
}
|
|
11
11
|
catch (err) {
|
|
12
12
|
if (clientConfig.followRegionRedirects &&
|
|
13
|
-
err.$metadata.httpStatusCode === 301) {
|
|
13
|
+
((_a = err === null || err === void 0 ? void 0 : err.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) === 301) {
|
|
14
14
|
try {
|
|
15
15
|
const actualRegion = err.$response.headers["x-amz-bucket-region"];
|
|
16
|
-
(
|
|
16
|
+
(_b = context.logger) === null || _b === void 0 ? void 0 : _b.debug(`Redirecting from ${await clientConfig.region()} to ${actualRegion}`);
|
|
17
17
|
context.__s3RegionRedirect = actualRegion;
|
|
18
18
|
}
|
|
19
19
|
catch (e) {
|
|
@@ -6,7 +6,7 @@ export function regionRedirectMiddleware(clientConfig) {
|
|
|
6
6
|
}
|
|
7
7
|
catch (err) {
|
|
8
8
|
if (clientConfig.followRegionRedirects &&
|
|
9
|
-
err
|
|
9
|
+
err?.$metadata?.httpStatusCode === 301) {
|
|
10
10
|
try {
|
|
11
11
|
const actualRegion = err.$response.headers["x-amz-bucket-region"];
|
|
12
12
|
context.logger?.debug(`Redirecting from ${await clientConfig.region()} to ${actualRegion}`);
|