fix replication of checksum when encryption is enabled (#20161)

- Adding functional tests
- Return checksum header on GET/HEAD, previously this was returning
  InvalidPartNumber error
This commit is contained in:
Poorna
2024-07-29 01:02:16 -07:00
committed by GitHub
parent 3ae104edae
commit 6651c655cb
5 changed files with 115 additions and 31 deletions

View File

@@ -1172,6 +1172,14 @@ func (o *ObjectInfo) decryptChecksums(part int, h http.Header) map[string]string
if len(data) == 0 {
return nil
}
if part > 0 && !crypto.SSEC.IsEncrypted(o.UserDefined) {
// already decrypted in ToObjectInfo for multipart objects
for _, pi := range o.Parts {
if pi.Number == part {
return pi.Checksums
}
}
}
if _, encrypted := crypto.IsEncrypted(o.UserDefined); encrypted {
decrypted, err := o.metadataDecrypter(h)("object-checksum", data)
if err != nil {