Skip to content

Commit

Permalink
fix range calculation in compose_object API (#1416)
Browse files Browse the repository at this point in the history
Signed-off-by: Bala.FA <[email protected]>
  • Loading branch information
balamurugana authored Apr 30, 2024
1 parent e10196f commit dbde61e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions minio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,13 +1601,11 @@ def compose_object(
continue
while size > 0:
part_number += 1
start_bytes = offset
end_bytes = start_bytes + MAX_PART_SIZE
if size < MAX_PART_SIZE:
end_bytes = start_bytes + size
length = size if size < MAX_PART_SIZE else MAX_PART_SIZE
end_bytes = offset + length - 1
headers_copy = headers.copy()
headers_copy["x-amz-copy-source-range"] = (
f"bytes={start_bytes}-{end_bytes}"
f"bytes={offset}-{end_bytes}"
)
etag, _ = self._upload_part_copy(
bucket_name,
Expand All @@ -1617,8 +1615,8 @@ def compose_object(
headers_copy,
)
total_parts.append(Part(part_number, etag))
offset = start_bytes
size -= end_bytes - start_bytes
offset += length
size -= length
result = self._complete_multipart_upload(
bucket_name, object_name, upload_id, total_parts,
)
Expand Down

0 comments on commit dbde61e

Please sign in to comment.