storage: use bytes when reading chunks (#36515)
This commit is contained in:
parent
5da68239d3
commit
fd88b46128
|
@ -547,7 +547,7 @@ def file_digest(content, chunk_size=100000):
|
|||
|
||||
def read_chunk():
|
||||
return content.read(chunk_size)
|
||||
for chunk in iter(read_chunk, ''):
|
||||
for chunk in iter(read_chunk, b''):
|
||||
digest.update(chunk)
|
||||
return digest.hexdigest()
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ def atomic_write(path, content, async_op=False):
|
|||
# file pointer
|
||||
def read100k():
|
||||
return content.read(100000)
|
||||
for piece in iter(read100k, ''):
|
||||
for piece in iter(read100k, b''):
|
||||
f.write(piece)
|
||||
else:
|
||||
f.write(content)
|
||||
|
|
Loading…
Reference in New Issue