Skip to content

Commit 5040217

Browse files
committed
fix: 优化 crc64 校验
1 parent 0ec0431 commit 5040217

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cos-nodejs-sdk-v5",
3-
"version": "2.15.1",
3+
"version": "2.15.2",
44
"description": "cos nodejs sdk v5",
55
"main": "index.js",
66
"types": "index.d.ts",

sdk/advance.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,9 +1614,11 @@ function downloadFile(params, callback) {
16141614

16151615
// 只校验文件大小和 crc64 是否有变更
16161616
var changed;
1617-
if (chunkHeaders['x-cos-hash-crc64ecma'] !== head.crc64ecma)
1617+
if (chunkHeaders['x-cos-hash-crc64ecma'] && head.crc64ecma && chunkHeaders['x-cos-hash-crc64ecma'] !== head.crc64ecma) {
16181618
changed = 'download error, x-cos-hash-crc64ecma has changed.';
1619-
else if (totalSize !== head.size) changed = 'download error, Last-Modified has changed.';
1619+
} else if (totalSize !== head.size) {
1620+
changed = 'download error, Last-Modified has changed.';
1621+
}
16201622
// else if (data.ETag !== head.ETag) error = 'download error, ETag has changed.';
16211623
// else if (chunkHeaders['last-modified'] !== head.mtime) error = 'download error, Last-Modified has changed.';
16221624

0 commit comments

Comments
 (0)