Skip to content

Commit 5740a0a

Browse files
author
鲁严波
committed
修复长度为0的文件的hash计算错误的问题
1 parent 468544c commit 5740a0a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

qiniu/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ def etag_stream(input_stream):
117117
输入流的etag值
118118
"""
119119
array = [_sha1(block) for block in _file_iter(input_stream, _BLOCK_SIZE)]
120+
if len(array) == 0:
121+
array = [_sha1(b'')]
120122
if len(array) == 1:
121123
data = array[0]
122124
prefix = b'\x16'

0 commit comments

Comments
 (0)