Skip to content

Commit ca48fea

Browse files
committed
旧的region域名不带cos.
1 parent cfff58f commit ca48fea

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/base.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,6 @@ function _putObject(params, callback) {
787787
headers['Content-Type'] = params['ContentType'];
788788
headers['Expect'] = params['Expect'];
789789
headers['Expires'] = params['Expires'];
790-
// headers['x-cos-content-sha1'] = params['ContentSha1'];
791790
headers['x-cos-acl'] = params['ACL'];
792791
headers['x-cos-grant-read'] = params['GrantRead'];
793792
headers['x-cos-grant-write'] = params['GrantWrite'];
@@ -1113,7 +1112,6 @@ function putObjectCopy(params, callback) {
11131112
headers['Content-Type'] = params['ContentType'];
11141113
headers['Expect'] = params['Expect'];
11151114
headers['Expires'] = params['Expires'];
1116-
// headers['x-cos-content-sha1'] = params['ContentSha1'];
11171115

11181116
for (var key in params) {
11191117
if (key.indexOf('x-cos-meta-') > -1) {
@@ -1281,7 +1279,6 @@ function multipartUpload(params, callback) {
12811279

12821280
headers['Content-Length'] = params['ContentLength'];
12831281
headers['Expect'] = params['Expect'];
1284-
// headers['x-cos-content-sha1'] = params['ContentSha1'];
12851282

12861283
var PartNumber = params['PartNumber'];
12871284
var UploadId = params['UploadId'];
@@ -1558,7 +1555,11 @@ function getUrl(params) {
15581555
var appId = params.appId;
15591556
var protocol = util.isBrowser && location.protocol === 'https:' ? 'https:' : 'http:';
15601557
if (!domain) {
1561-
domain = '{{Bucket}}-{{AppId}}.cos.{{Region}}.myqcloud.com';
1558+
if (['cn-south', 'cn-south-2', 'cn-north', 'cn-east', 'cn-southwest', 'sg'].indexOf(region) > -1) {
1559+
domain = '{{Bucket}}-{{AppId}}.{{Region}}.myqcloud.com';
1560+
} else {
1561+
domain = '{{Bucket}}-{{AppId}}.cos.{{Region}}.myqcloud.com';
1562+
}
15621563
}
15631564
domain = domain.replace(/\{\{AppId\}\}/ig, appId)
15641565
.replace(/\{\{Bucket\}\}/ig, bucket)
@@ -1573,7 +1574,7 @@ function getUrl(params) {
15731574
var url = domain;
15741575

15751576
if (object) {
1576-
url += '/' + encodeURIComponent(object);
1577+
url += '/' + encodeURIComponent(object).replace(/%2F/g, '/');
15771578
}
15781579

15791580
if (action) {

0 commit comments

Comments
 (0)