Fix PutObject Trailing checksum (#20456)

PutObject would verify trailing checksums, but not store them.

Fixes #20455
This commit is contained in:
Klaus Post
2024-09-19 05:59:07 -07:00
committed by GitHub
parent e1c2344591
commit 05a6c170bf
4 changed files with 21 additions and 5 deletions

View File

@@ -335,6 +335,10 @@ func (c *Checksum) AppendTo(b []byte, parts []byte) []byte {
var tmp [binary.MaxVarintLen32]byte
n := binary.PutUvarint(tmp[:], uint64(c.Type))
crc := c.Raw
if c.Type.Trailing() {
// When we serialize we don't care if it was trailing.
c.Type ^= ChecksumTrailing
}
if len(crc) != c.Type.RawByteLen() {
return b
}