s3api: answer a malformed Cache-Control on PutObject with InvalidRequest (#12733)

PutObject rejected a Cache-Control value it could not parse with
InvalidDigest, whose message is about Content-MD5, even when the request
sent no Content-MD5. CreateMultipartUpload already answers the same parse
error with InvalidRequest; PutObject now does too.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 authored and GitHub committed 2026-11-18 11:03:57 -08:00
1 parent ebc77400ca
commit 94de65b3b5
2 files changed
+40 -1

No files matched your search

+1 -1
View File
@@ -147,7 +147,7 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
if r.Header.Get("Cache-Control") != "" {
if _, err = cacheobject.ParseRequestCacheControl(r.Header.Get("Cache-Control")); err != nil {
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidDigest)
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidRequest)
return
}
}