Skip to content

Commit

Permalink
fix:修复host签名时不兼容全球加速域名
Browse files Browse the repository at this point in the history
  • Loading branch information
livehigh committed Dec 27, 2021
1 parent 75ad429 commit adb5e3e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
6 changes: 1 addition & 5 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -8050,16 +8050,12 @@ function getUrl(params) {

var getSignHost = function (opt) {
if (!opt.Bucket || !opt.Region) return '';
var region = opt.Region;
if (this.options.UseAccelerate) {
region = 'accelerate';
}
var url = opt.Url || getUrl({
ForcePathStyle: this.options.ForcePathStyle,
protocol: this.options.Protocol,
domain: this.options.Domain,
bucket: opt.Bucket,
region: region
region: this.options.UseAccelerate ? 'accelerate' : opt.Region
});
var urlHost = url.replace(/^https?:\/\/([^/]+)(\/.*)?$/, '$1');
var standardHostReg = new RegExp('^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$');
Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3184,16 +3184,12 @@ function getUrl(params) {

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

0 comments on commit adb5e3e

Please sign in to comment.