mirror of
https://github.com/pgsty/minio.git
synced 2026-08-10 00:03:29 +03:00
3e14733f15
hash.Checksum.AddPart returned before seeding the accumulator when the part was empty, so a multipart object with no content at all ended up with no checksum instead of the checksum of zero bytes. Completing such an upload failed with XAmzContentChecksumMismatch when the client supplied the correct object checksum, and stored an empty checksum when it did not. Run the type check and the first checksum seeding before the zero size early return. Appending zero bytes still leaves an existing accumulator unchanged, so only the all empty case changes: a zero length part followed by content already merged correctly, because prepending no bytes does not alter a CRC. AddPart has a single production caller, the multipart completion path, and its part checksum type is derived from the upload's own checksum type, so the type check now reached for zero sized parts cannot fire there. Add a table test over CRC32, CRC32C and CRC64NVME covering every position an empty part can take, and an API level zero length full object upload that exercises the persisted AppendTo/ReadCheckSums round trip. Co-authored-by: ChatGPT <noreply@openai.com> Co-authored-by: Claude <noreply@anthropic.com>