Skip to content

Commit e3080da

Browse files
committed
testing: parlib: fix empty upload for small objects
For objects with file size less than 100 MiB, we use a direct PUT request to send the data, rather than a multipart upload. However, rather than passing the block of data that we already read from the file (first_chunk), we are reading from the now exhausted file, so we always upload empty data. Fix this so that we get correct uploads. Signed-off-by: Stephen Brennan <[email protected]>
1 parent 71ef529 commit e3080da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

testing/parlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def put_object(
360360
"""
361361
first_block = data.read(chunk_size)
362362
if len(first_block) < chunk_size:
363-
self.put_object_raw(key, data.read())
363+
self.put_object_raw(key, first_block)
364364
else:
365365
self.put_object_multipart(
366366
key, data, chunk_size, first_block=first_block

0 commit comments

Comments
 (0)