Skip to content

Commit dbde61e

Browse files
authored
fix range calculation in compose_object API (#1416)
Signed-off-by: Bala.FA <bala@minio.io>
1 parent e10196f commit dbde61e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Diff for: minio/api.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -1601,13 +1601,11 @@ def compose_object(
16011601
continue
16021602
while size > 0:
16031603
part_number += 1
1604-
start_bytes = offset
1605-
end_bytes = start_bytes + MAX_PART_SIZE
1606-
if size < MAX_PART_SIZE:
1607-
end_bytes = start_bytes + size
1604+
length = size if size < MAX_PART_SIZE else MAX_PART_SIZE
1605+
end_bytes = offset + length - 1
16081606
headers_copy = headers.copy()
16091607
headers_copy["x-amz-copy-source-range"] = (
1610-
f"bytes={start_bytes}-{end_bytes}"
1608+
f"bytes={offset}-{end_bytes}"
16111609
)
16121610
etag, _ = self._upload_part_copy(
16131611
bucket_name,
@@ -1617,8 +1615,8 @@ def compose_object(
16171615
headers_copy,
16181616
)
16191617
total_parts.append(Part(part_number, etag))
1620-
offset = start_bytes
1621-
size -= end_bytes - start_bytes
1618+
offset += length
1619+
size -= length
16221620
result = self._complete_multipart_upload(
16231621
bucket_name, object_name, upload_id, total_parts,
16241622
)

0 commit comments

Comments
 (0)