@baiducloud/sdk
Advanced tools
+6
-0
| # CHANGELOG | ||
| ## 1.0.8-beta.4 | ||
| _published on 2026-01-15_ | ||
| - chore: `customGenerateUrl` support `lccLocation` param. | ||
| ## 1.0.8-beta.3 | ||
@@ -4,0 +10,0 @@ |
+1
-1
| { | ||
| "name": "@baiducloud/sdk", | ||
| "version": "1.0.8-beta.3", | ||
| "version": "1.0.8-beta.4", | ||
| "description": "Baidu Cloud Engine JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
+29
-28
@@ -263,9 +263,13 @@ /** | ||
| // 判断是否为ipv4 | ||
| const isIPv4 = function(input) { | ||
| return /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(input); | ||
| const isIPv4 = function (input) { | ||
| return /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test( | ||
| input | ||
| ); | ||
| }; | ||
| // 判断是否为ipv6 | ||
| const isIPv6 = function(input) { | ||
| return /^(([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))$/.test(input); | ||
| const isIPv6 = function (input) { | ||
| return /^(([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))$/.test( | ||
| input | ||
| ); | ||
| }; | ||
@@ -344,7 +348,4 @@ | ||
| const generateBaseEndpoint = function (protocol, region) { | ||
| return util.format('%s://%s.%s', | ||
| protocol, | ||
| region, | ||
| config.DEFAULT_BOS_DOMAIN); | ||
| } | ||
| return util.format('%s://%s.%s', protocol, region, config.DEFAULT_BOS_DOMAIN); | ||
| }; | ||
@@ -356,8 +357,9 @@ /** | ||
| bucketName, | ||
| endpoint, | ||
| endpoint, | ||
| protocol, | ||
| region, | ||
| customGenerateUrl, | ||
| cname_enabled=false, | ||
| pathStyleEnable=false, | ||
| lccLocation, | ||
| cname_enabled = false, | ||
| pathStyleEnable = false | ||
| }) { | ||
@@ -367,5 +369,5 @@ var resolvedEndpoint = endpoint; | ||
| if (customGenerateUrl) { | ||
| return customGenerateUrl(bucketName, region); | ||
| return customGenerateUrl(bucketName, region, {lccLocation: lccLocation}); | ||
| } | ||
| // 使用的是自定义域名 / virtual-host | ||
@@ -375,23 +377,22 @@ if (isCnameLikeHost(resolvedEndpoint) || cname_enabled) { | ||
| if (needCompatibleBucketAndEndpoint(bucketName, resolvedEndpoint)) { | ||
| // bucket from api and from endpoint is different | ||
| resolvedEndpoint = replaceEndpointByBucket(bucketName, resolvedEndpoint); | ||
| // bucket from api and from endpoint is different | ||
| resolvedEndpoint = replaceEndpointByBucket(bucketName, resolvedEndpoint); | ||
| } | ||
| } | ||
| else { | ||
| } else { | ||
| // 非ip/bns,pathStyleEnable不为true,强制转为pathStyle | ||
| // 否则保持原状 | ||
| if (!pathStyleEnable && !isIpHost(resolvedEndpoint)) { | ||
| // if this region is provided, generate base endpoint | ||
| if (region) { | ||
| resolvedEndpoint = generateBaseEndpoint(protocol, region); | ||
| } | ||
| // service级别的接口不需要转换 | ||
| if (bucketName && isBosHost(resolvedEndpoint)) { | ||
| const {protocol, host} = getDomainWithoutProtocal(resolvedEndpoint); | ||
| resolvedEndpoint = protocol + '//' + bucketName + '.' + host; | ||
| } | ||
| // if this region is provided, generate base endpoint | ||
| if (region) { | ||
| resolvedEndpoint = generateBaseEndpoint(protocol, region); | ||
| } | ||
| // service级别的接口不需要转换 | ||
| if (bucketName && isBosHost(resolvedEndpoint)) { | ||
| const {protocol, host} = getDomainWithoutProtocal(resolvedEndpoint); | ||
| resolvedEndpoint = protocol + '//' + bucketName + '.' + host; | ||
| } | ||
| } | ||
| } | ||
| return resolvedEndpoint; | ||
| } | ||
| }; | ||
@@ -398,0 +399,0 @@ exports.domainUtils = { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 5 instances in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 5 instances in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
3731353
0.03%75050
0.02%