mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
UploadPartCopy loaded the whole source object into a byte array and parsed x-amz-copy-source-range with Integer.parseInt, so a source of 2 GiB or more, or any range offset past 2 GiB, failed as an internal error. A range that ran past the end of the source was silently padded with zero bytes. The source is now opened as a stream, the way GetObject serves it, and only the requested range is read, with offsets parsed as longs. A bad range gets the error S3 returns, as recorded in LocalStack's AWS-validated snapshot for UploadPartCopy: anything but one bytes=first-last range with first <= last is InvalidArgument naming the expected form, a range that ends past the source is InvalidArgument naming its size, and one that starts past it is InvalidRequest; the InvalidArgument errors carry ArgumentName and ArgumentValue. A copied part is still held in a byte array on its way into the upload, so a range over that limit returns EntityTooLarge until UploadPart can store a part without one.