Skip to content

Commit

Permalink
fix range calculation in composeObject API (minio#1553)
Browse files Browse the repository at this point in the history
Signed-off-by: Bala.FA <[email protected]>
  • Loading branch information
balamurugana authored Jun 14, 2024
1 parent ae87105 commit f80a702
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions api/src/main/java/io/minio/MinioAsyncClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -769,15 +769,15 @@ public CompletableFuture<ObjectWriteResponse> composeObject(ComposeObjectArgs ar
while (size > 0) {
partNumber++;

long startBytes = offset;
long endBytes = startBytes + ObjectWriteArgs.MAX_PART_SIZE;
if (size < ObjectWriteArgs.MAX_PART_SIZE)
endBytes = startBytes + size;
long length = size;
if (length > ObjectWriteArgs.MAX_PART_SIZE) {
length = ObjectWriteArgs.MAX_PART_SIZE;
}
long endBytes = offset + length - 1;

Multimap<String, String> headersCopy = newMultimap(headers);
headersCopy.put(
"x-amz-copy-source-range",
"bytes=" + startBytes + "-" + endBytes);
"x-amz-copy-source-range", "bytes=" + offset + "-" + endBytes);

final int partNum = partNumber;
future =
Expand All @@ -801,8 +801,8 @@ public CompletableFuture<ObjectWriteResponse> composeObject(ComposeObjectArgs ar
throw new CompletionException(e);
}
});
offset = startBytes;
size -= (endBytes - startBytes);
offset += length;
size -= length;
}
}

Expand Down

0 comments on commit f80a702

Please sign in to comment.