Skip to content

Commit 28adb2e

Browse files
authored
Merge pull request #136 from livehigh/master
fix:修复host签名时不兼容全球加速域名
2 parents 54198d6 + adb5e3e commit 28adb2e

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

dist/cos-js-sdk-v5.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,7 +2485,7 @@ COS.util = {
24852485
json2xml: util.json2xml
24862486
};
24872487
COS.getAuthorization = util.getAuth;
2488-
COS.version = '1.3.3';
2488+
COS.version = '1.3.4';
24892489

24902490
module.exports = COS;
24912491

@@ -8049,13 +8049,13 @@ function getUrl(params) {
80498049
}
80508050

80518051
var getSignHost = function (opt) {
8052-
if (!opt.Bucket || !opt.Bucket) return '';
8052+
if (!opt.Bucket || !opt.Region) return '';
80538053
var url = opt.Url || getUrl({
80548054
ForcePathStyle: this.options.ForcePathStyle,
80558055
protocol: this.options.Protocol,
80568056
domain: this.options.Domain,
80578057
bucket: opt.Bucket,
8058-
region: opt.Region
8058+
region: this.options.UseAccelerate ? 'accelerate' : opt.Region
80598059
});
80608060
var urlHost = url.replace(/^https?:\/\/([^/]+)(\/.*)?$/, '$1');
80618061
var standardHostReg = new RegExp('^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$');
@@ -8065,7 +8065,6 @@ var getSignHost = function (opt) {
80658065

80668066
// 异步获取签名
80678067
function getAuthorizationAsync(params, callback) {
8068-
80698068
var headers = util.clone(params.Headers);
80708069
var headerHost = '';
80718070
util.each(headers, function (v, k) {

dist/cos-js-sdk-v5.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cos-js-sdk-v5",
3-
"version": "1.3.3",
3+
"version": "1.3.4",
44
"description": "JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)",
55
"main": "index.js",
66
"types": "index.d.ts",

src/base.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3183,13 +3183,13 @@ function getUrl(params) {
31833183
}
31843184

31853185
var getSignHost = function (opt) {
3186-
if (!opt.Bucket || !opt.Bucket) return '';
3186+
if (!opt.Bucket || !opt.Region) return '';
31873187
var url = opt.Url || getUrl({
31883188
ForcePathStyle: this.options.ForcePathStyle,
31893189
protocol: this.options.Protocol,
31903190
domain: this.options.Domain,
31913191
bucket: opt.Bucket,
3192-
region: opt.Region,
3192+
region: this.options.UseAccelerate ? 'accelerate' : opt.Region,
31933193
});
31943194
var urlHost = url.replace(/^https?:\/\/([^/]+)(\/.*)?$/, '$1');
31953195
var standardHostReg = new RegExp('^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$');
@@ -3200,7 +3200,6 @@ var getSignHost = function (opt) {
32003200

32013201
// 异步获取签名
32023202
function getAuthorizationAsync(params, callback) {
3203-
32043203
var headers = util.clone(params.Headers);
32053204
var headerHost = '';
32063205
util.each(headers, function (v, k) {

src/cos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ COS.util = {
7777
json2xml: util.json2xml,
7878
};
7979
COS.getAuthorization = util.getAuth;
80-
COS.version = '1.3.3';
80+
COS.version = '1.3.4';
8181

8282
module.exports = COS;

0 commit comments

Comments
 (0)