Skip to content

Commit 2b50f5c

Browse files
authored
[Blob][Fix][ShortRead]Read the Remainder Until We Have Expected Bytes in Total (#600)
Basically, if x bytes are desired, but only y bytes are read, then we should read x-y bytes next time, and keep trying to read the remainder until we have x bytes in total.
1 parent b8016d9 commit 2b50f5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

azure-storage-blob/azure/storage/blob/blockblobservice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ def create_blob_from_stream(
578578

579579
# keep reading from stream util length of data >= count or reaching the end of stream
580580
while len(data) < count and len(data_chunk) is not 0:
581-
data_chunk = stream.read(count)
581+
data_chunk = stream.read(count - len(data))
582582
data += data_chunk
583583

584584
if len(data) < count:

0 commit comments

Comments
 (0)