Skip to content

Commit

Permalink
修改 demo
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Aug 6, 2018
1 parent e373ab7 commit 8da0c02
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions demo/demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var config = {
Bucket: 'test-1250000000',
Bucket: 'test-1251902136',
Region: 'ap-guangzhou'
};

Expand All @@ -18,6 +18,7 @@ var util = {
};

var cos = new COS({
FileParallelLimit: 5,
getAuthorization: function (options,callback) {
// 方法一、后端通过获取临时密钥给到前端,前端计算签名
// var url = 'http://127.0.0.1:3000/sts';
Expand Down Expand Up @@ -142,7 +143,7 @@ function getAuth() {
Key: key
}, function (auth) {
// 注意:这里的 Bucket 格式是 test-1250000000
logger.log('http://' + config.Bucket + '.cos.' + config.Region + '.myqcloud.com' + '/' + encodeURIComponent(key) + '?sign=' + encodeURIComponent(auth));
logger.log('http://' + config.Bucket + '.cos.' + config.Region + '.myqcloud.com' + '/' + encodeURIComponent(key).replace(/%2F/g, '/') + '?sign=' + encodeURIComponent(auth));
});
}

Expand Down Expand Up @@ -495,7 +496,7 @@ function putObjectCopy() {
Bucket: config.Bucket, // Bucket 格式:test-1250000000
Region: config.Region,
Key: '1mb.copy.zip',
CopySource: config.Bucket + '.cos.' + config.Region + '.myqcloud.com/' + encodeURIComponent('1mb.zip'), // Bucket 格式:test-1250000000
CopySource: config.Bucket + '.cos.' + config.Region + '.myqcloud.com/' + encodeURIComponent('1mb.zip').replace(/%2F/g, '/'), // Bucket 格式:test-1250000000
}, function (err, data) {
logger.log(err || data);
});
Expand Down Expand Up @@ -735,7 +736,7 @@ function sliceCopyFile() {
var sourceName = '3mb.zip';
var Key = '3mb.copy.zip';

var sourcePath = config.Bucket + '.cos.' + config.Region + '.myqcloud.com/'+ encodeURIComponent(sourceName);
var sourcePath = config.Bucket + '.cos.' + config.Region + '.myqcloud.com/'+ encodeURIComponent(sourceName).replace(/%2F/g, '/');

cos.sliceCopyFile({
Bucket: config.Bucket, // Bucket 格式:test-1250000000
Expand Down

0 comments on commit 8da0c02

Please sign in to comment.