Skip to content

Commit

Permalink
fix the bug of resume upload content buffered when stream not closed
Browse files Browse the repository at this point in the history
  • Loading branch information
jemygraw committed Jun 14, 2018
1 parent 8edba1f commit 48f5ca6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## CHANGE LOG

## v7.1.9
- 修复新版node下resume up方式文件内容被缓存而导致的上传失败

## v7.1.8
- 修复 index.d.ts 文件中zone的设置

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qiniu",
"version": "7.1.8",
"version": "7.1.9",
"description": "Node wrapper for Qiniu Resource (Cloud) Storage API",
"main": "index.js",
"directories": {
Expand Down
7 changes: 6 additions & 1 deletion qiniu/storage/resume.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ResumeUploader.prototype.putStream = function(uploadToken, key, rsStream,
rsStream.on("error", function(err) {
//callbackFunc
callbackFunc(err, null, null);
rsStream.close();
return;
});

Expand All @@ -67,6 +68,7 @@ ResumeUploader.prototype.putStream = function(uploadToken, key, rsStream,
cZoneExpire) {
if (err) {
callbackFunc(err, null, null);
rsStream.close();
return;
}

Expand Down Expand Up @@ -164,6 +166,7 @@ function putReq(config, uploadToken, key, rsStream, rsStreamLen, putExtra,
var bodyCrc32 = parseInt("0x" + getCrc32(readData));
if (respInfo.statusCode != 200 || respBody.crc32 != bodyCrc32) {
callbackFunc(respErr, respBody, respInfo);
rsStream.close();
return;
} else {
finishedBlock += 1;
Expand Down Expand Up @@ -197,7 +200,9 @@ function putReq(config, uploadToken, key, rsStream, rsStreamLen, putExtra,
if (!isSent && rsStreamLen === 0) {
mkfileReq(upDomain, uploadToken, fileSize, finishedCtxList, key, putExtra, callbackFunc)
}
})

rsStream.close();
});
}

function mkblkReq(upDomain, uploadToken, blkData, callbackFunc) {
Expand Down

0 comments on commit 48f5ca6

Please sign in to comment.