fix range calculation in compose_object API (#87)

Signed-off-by: Bala.FA <bala@minio.io>
This commit is contained in:
Bala FA 2024-05-30 01:22:33 +05:30 committed by GitHub
parent 43af36441a
commit 18c5707a4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -941,16 +941,16 @@ impl Client {
while size > 0 { while size > 0 {
part_number += 1; part_number += 1;
let start_bytes = offset; let mut length = size;
let mut end_bytes = start_bytes + MAX_PART_SIZE; if length > MAX_PART_SIZE {
if size < MAX_PART_SIZE { length = MAX_PART_SIZE;
end_bytes = start_bytes + size;
} }
let end_bytes = offset + length - 1;
let mut headers_copy = headers.clone(); let mut headers_copy = headers.clone();
headers_copy.insert( headers_copy.insert(
String::from("x-amz-copy-source-range"), String::from("x-amz-copy-source-range"),
format!("bytes={}-{}", start_bytes, end_bytes), format!("bytes={}-{}", offset, end_bytes),
); );
let mut upc_args = UploadPartCopyArgs::new( let mut upc_args = UploadPartCopyArgs::new(
@ -968,8 +968,8 @@ impl Client {
etag: resp.etag, etag: resp.etag,
}); });
offset = start_bytes; offset += length;
size -= end_bytes - start_bytes; size -= length;
} }
} }
} }