fix: strip aws-chunked when the request declares no payload type

`ParseContentEncoding` dropped the `aws-chunked` token only for streaming payload types, so a presigned request kept it: such a request is signed as `UNSIGNED-PAYLOAD` and sends no `x-amz-content-sha256` header, and S3 strips the token there. Keep it only when the request declares a non streaming payload type.

S3 applies this to the `Content-Encoding` header before any API sees it, so `CopyObject` and `CreateMultipartUpload` follow the same rule even though neither carries a body to frame. `POSTObject` takes its value from a form field rather than the header and is left alone.
This commit is contained in:
niksis02
2026-09-22 02:05:00 +04:00
parent 888fd5c1ad
commit bbe398af72
7 changed files with 294 additions and 8 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ func (c S3ApiController) CreateMultipartUpload(ctx fiber.Ctx) (*Response, error)
contentDisposition := ctx.Get("Content-Disposition")
contentLanguage := ctx.Get("Content-Language")
cacheControl := ctx.Get("Cache-Control")
contentEncoding := ctx.Get("Content-Encoding")
contentEncoding := utils.ParseContentEncoding(ctx)
tagging := ctx.Get("X-Amz-Tagging")
expires := ctx.Get("Expires")
websiteRedirectLocation := ctx.Get("X-Amz-Website-Redirect-Location")
+1 -1
View File
@@ -516,7 +516,7 @@ func (c S3ApiController) CopyObject(ctx fiber.Ctx) (*Response, error) {
metaDirective := types.MetadataDirective(ctx.Get("X-Amz-Metadata-Directive", string(types.MetadataDirectiveCopy)))
taggingDirective := types.TaggingDirective(ctx.Get("X-Amz-Tagging-Directive", string(types.TaggingDirectiveCopy)))
contentType := ctx.Get("Content-Type", defaultContentType)
contentEncoding := ctx.Get("Content-Encoding")
contentEncoding := utils.ParseContentEncoding(ctx)
contentDisposition := ctx.Get("Content-Disposition")
contentLanguage := ctx.Get("Content-Language")
cacheControl := ctx.Get("Cache-Control")