Skip to content

Commit

Permalink
change demo
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Jul 25, 2018
1 parent 1e6f1af commit 342b268
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function getAuth() {
Key: key
}, function (auth) {
// 注意:这里的 Bucket 格式是 test-1250000000
console.log('http://' + config.Bucket + '.cos.' + config.Region + '.myqcloud.com' + '/' + key + '?sign=' + encodeURIComponent(auth));
console.log('http://' + config.Bucket + '.cos.' + config.Region + '.myqcloud.com' + '/' + encodeURIComponent(key) + '?sign=' + encodeURIComponent(auth));
});
}

Expand Down Expand Up @@ -494,7 +494,7 @@ function putObjectCopy() {
Bucket: config.Bucket, // Bucket 格式:test-1250000000
Region: config.Region,
Key: '1mb.copy.zip',
CopySource: config.Bucket + '.cos.' + config.Region + '.myqcloud.com/1mb.zip', // Bucket 格式:test-1250000000
CopySource: config.Bucket + '.cos.' + config.Region + '.myqcloud.com/' + encodeURIComponent('1mb.zip'), // Bucket 格式:test-1250000000
}, function (err, data) {
console.log(err || data);
});
Expand Down Expand Up @@ -616,11 +616,11 @@ function abortUploadTask() {
}

function sliceUploadFile() {
var blob = util.createFile({size: 1024 * 1024 * 30});
var blob = util.createFile({size: 1024 * 1024 * 3});
cos.sliceUploadFile({
Bucket: config.Bucket, // Bucket 格式:test-1250000000
Region: config.Region,
Key: '30mb.zip', /* 必须 */
Key: '3mb.zip', /* 必须 */
Body: blob,
TaskReady: function (tid) {
TaskId = tid;
Expand Down Expand Up @@ -734,7 +734,7 @@ function sliceCopyFile() {
var sourceName = '3mb.zip';
var Key = '3mb.copy.zip';

var sourcePath = config.Bucket + '.cos.' + config.Region + '.myqcloud.com/'+ sourceName;
var sourcePath = config.Bucket + '.cos.' + config.Region + '.myqcloud.com/'+ encodeURIComponent(sourceName);

cos.sliceCopyFile({
Bucket: config.Bucket, // Bucket 格式:test-1250000000
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"request": "^2.85.0",
"request": "^2.87.0",
"webpack": "^3.8.1"
}
}

0 comments on commit 342b268

Please sign in to comment.