@aws-sdk/middleware-sdk-s3-control 3.363.0 → 3.370.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.
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deduplicateHostPrefix = void 0;
|
|
4
|
+
const util_endpoints_1 = require("@aws-sdk/util-endpoints");
|
|
4
5
|
const deduplicateHostPrefix = (hostname) => {
|
|
5
|
-
const [
|
|
6
|
-
if (
|
|
7
|
-
return
|
|
6
|
+
const [p1, p2, p3, p4, ...rest] = hostname.split(".");
|
|
7
|
+
if ((0, util_endpoints_1.isIpAddress)(`${p1}.${p2}.${p3}.${parseInt(p4, 10)}`)) {
|
|
8
|
+
return hostname;
|
|
9
|
+
}
|
|
10
|
+
if (p1 === p2) {
|
|
11
|
+
return [p2, p3, p4, ...rest].join(".");
|
|
8
12
|
}
|
|
9
13
|
return hostname;
|
|
10
14
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { isIpAddress } from "@aws-sdk/util-endpoints";
|
|
1
2
|
export const deduplicateHostPrefix = (hostname) => {
|
|
2
|
-
const [
|
|
3
|
-
if (
|
|
4
|
-
return
|
|
3
|
+
const [p1, p2, p3, p4, ...rest] = hostname.split(".");
|
|
4
|
+
if (isIpAddress(`${p1}.${p2}.${p3}.${parseInt(p4, 10)}`)) {
|
|
5
|
+
return hostname;
|
|
6
|
+
}
|
|
7
|
+
if (p1 === p2) {
|
|
8
|
+
return [p2, p3, p4, ...rest].join(".");
|
|
5
9
|
}
|
|
6
10
|
return hostname;
|
|
7
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-s3-control",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.370.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/middleware-bucket-endpoint": "3.
|
|
25
|
-
"@aws-sdk/types": "3.
|
|
24
|
+
"@aws-sdk/middleware-bucket-endpoint": "3.370.0",
|
|
25
|
+
"@aws-sdk/types": "3.370.0",
|
|
26
26
|
"@aws-sdk/util-arn-parser": "3.310.0",
|
|
27
|
+
"@aws-sdk/util-endpoints": "3.370.0",
|
|
27
28
|
"@smithy/protocol-http": "^1.1.0",
|
|
28
29
|
"@smithy/types": "^1.1.0",
|
|
29
30
|
"tslib": "^2.5.0"
|