Skip to content

Commit

Permalink
fix getObject bug
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Aug 17, 2019
1 parent d18e01a commit 6c9a10c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"homepage": "https://github.com/tencentyun/cos-js-sdk-v5#readme",
"dependencies": {
"body-parser": "^1.18.3",
"qcloud-cos-sts": "^3.0.0",
"qcloud-cos-sts": "^3.0.2",
"express": "^4.16.4"
},
"devDependencies": {
Expand Down
9 changes: 5 additions & 4 deletions server/sts.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ app.all('/sts', function (req, res, next) {
secretId: config.secretId,
secretKey: config.secretKey,
proxy: config.proxy,
region: config.region,
durationSeconds: config.durationSeconds,
policy: policy,
}, function (err, tempKeys) {
var result = JSON.stringify(err || tempKeys) || '';
res.send(result);
if (tempKeys) tempKeys.startTime = startTime;
res.send(err || tempKeys);
});
});

Expand Down Expand Up @@ -105,8 +106,8 @@ app.all('/sts', function (req, res, next) {
// durationSeconds: config.durationSeconds,
// policy: policy,
// }, function (err, tempKeys) {
// var result = JSON.stringify(err || tempKeys) || '';
// res.send(result);
// if (tempKeys) tempKeys.startTime = startTime;
// res.send(err || tempKeys);
// });
// });

Expand Down
2 changes: 2 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ group('mock readAsBinaryString', function () {
TaskId = taskId;
},
onProgress: function (info) {
if (info.percent === 0) return;
assert.ok(info.percent > 0.3, '分片续传成功');
cos.cancelTask(TaskId);
FileReader.prototype.readAsBinaryString = FileReader.prototype._readAsBinaryString;
Expand Down Expand Up @@ -527,6 +528,7 @@ group('sliceUploadFile(),pauseTask(),restartTask()', function () {
}, 1000);
}
if (paused && restarted) {
if (info.percent === 0) return;
assert.ok(info.percent > 0.3, '暂停和重试成功');
cos.cancelTask(TaskId);
done();
Expand Down

0 comments on commit 6c9a10c

Please sign in to comment.