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

@@ -248,10 +248,19 @@ func checkPreconditions(ctx context.Context, w http.ResponseWriter, r *http.Requ
}
// Check if the part number is correct.
if opts.PartNumber > 1 && opts.PartNumber > len(objInfo.Parts) {
// According to S3 we don't need to set any object information here.
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidPartNumber), r.URL)
return true
if opts.PartNumber > 1 {
partFound := false
for _, pi := range objInfo.Parts {
if pi.Number == opts.PartNumber {
partFound = true
break
}
}
if !partFound {
// According to S3 we don't need to set any object information here.
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidPartNumber), r.URL)
return true
}
}
// If-None-Match : Return the object only if its entity tag (ETag) is different from the