Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix range calculation in compose_object API #1416

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading