Skip to content

Commit 8e6e6ab

Browse files
committed
fix:修复host签名时不兼容全球加速域名
1 parent f12d068 commit 8e6e6ab

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

demo-album/lib/cos-wx-sdk-v5.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,7 @@ base.init(COS, task);
23062306
advance.init(COS, task);
23072307

23082308
COS.getAuthorization = util.getAuth;
2309-
COS.version = '1.1.3';
2309+
COS.version = '1.1.4';
23102310

23112311
module.exports = COS;
23122312

@@ -8419,13 +8419,13 @@ function getUrl(params) {
84198419
}
84208420

84218421
var getSignHost = function getSignHost(opt) {
8422-
if (!opt.Bucket || !opt.Bucket) return '';
8422+
if (!opt.Bucket || !opt.Region) return '';
84238423
var url = opt.Url || getUrl({
84248424
ForcePathStyle: this.options.ForcePathStyle,
84258425
protocol: this.options.Protocol,
84268426
domain: this.options.Domain,
84278427
bucket: opt.Bucket,
8428-
region: opt.Region
8428+
region: this.options.UseAccelerate ? 'accelerate' : opt.Region
84298429
});
84308430
var urlHost = url.replace(/^https?:\/\/([^/]+)(\/.*)?$/, '$1');
84318431
var standardHostReg = new RegExp('^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$');

demo-album/lib/cos-wx-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.

demo/lib/cos-wx-sdk-v5.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,7 @@ base.init(COS, task);
23062306
advance.init(COS, task);
23072307

23082308
COS.getAuthorization = util.getAuth;
2309-
COS.version = '1.1.3';
2309+
COS.version = '1.1.4';
23102310

23112311
module.exports = COS;
23122312

@@ -8419,13 +8419,13 @@ function getUrl(params) {
84198419
}
84208420

84218421
var getSignHost = function getSignHost(opt) {
8422-
if (!opt.Bucket || !opt.Bucket) return '';
8422+
if (!opt.Bucket || !opt.Region) return '';
84238423
var url = opt.Url || getUrl({
84248424
ForcePathStyle: this.options.ForcePathStyle,
84258425
protocol: this.options.Protocol,
84268426
domain: this.options.Domain,
84278427
bucket: opt.Bucket,
8428-
region: opt.Region
8428+
region: this.options.UseAccelerate ? 'accelerate' : opt.Region
84298429
});
84308430
var urlHost = url.replace(/^https?:\/\/([^/]+)(\/.*)?$/, '$1');
84318431
var standardHostReg = new RegExp('^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$');

demo/lib/cos-wx-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-wx-sdk-v5",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"description": "小程序 SDK for [腾讯云对象存储服务](https://cloud.tencent.com/product/cos)",
55
"main": "demo/lib/cos-wx-sdk-v5.min.js",
66
"scripts": {

src/base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3117,13 +3117,13 @@ function getUrl(params) {
31173117
}
31183118

31193119
var getSignHost = function (opt) {
3120-
if (!opt.Bucket || !opt.Bucket) return '';
3120+
if (!opt.Bucket || !opt.Region) return '';
31213121
var url = opt.Url || getUrl({
31223122
ForcePathStyle: this.options.ForcePathStyle,
31233123
protocol: this.options.Protocol,
31243124
domain: this.options.Domain,
31253125
bucket: opt.Bucket,
3126-
region: opt.Region,
3126+
region: this.options.UseAccelerate ? 'accelerate' : opt.Region,
31273127
});
31283128
var urlHost = url.replace(/^https?:\/\/([^/]+)(\/.*)?$/, '$1');
31293129
var standardHostReg = new RegExp('^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$');

src/cos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ base.init(COS, task);
6565
advance.init(COS, task);
6666

6767
COS.getAuthorization = util.getAuth;
68-
COS.version = '1.1.3';
68+
COS.version = '1.1.4';
6969

7070
module.exports = COS;

0 commit comments

Comments
 (0)