Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@baiducloud/sdk

Package Overview
Dependencies
Maintainers
8
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@baiducloud/sdk - npm Package Compare versions

Comparing version
1.0.8-beta.3
to
1.0.8-beta.4
+6
-0
CHANGELOG.md
# 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",

@@ -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\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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