mirror of
https://github.com/pgsty/minio.git
synced 2026-12-03 20:36:37 +03:00
fix(s3): trim whitespace and match aws-chunked case-insensitively in Content-Encoding
Content-Encoding is a comma-separated list of content-coding tokens with optional surrounding whitespace, and token names are case-insensitive per RFC 9110 Section 8.4. Previously, trimAwsChunkedContentEncoding split on commas and compared each raw segment against "aws-chunked" with exact string equality. Inputs such as "gzip, aws-chunked" or "AWS-Chunked" retained the transport coding in stored object metadata, and "aws-chunked, gzip" left a leading space in the persisted encoding. Trim surrounding whitespace on each comma-separated coding token and match "aws-chunked" with strings.EqualFold. Update the corresponding whitespace cases in TestExtractReplicationMetadataPreservesNormalizedMetadata and add unit tests in TestTrimAwsChunkedContentEncoding. Signed-off-by: lingyicute <xlyxinglinyi@gmail.com>
This commit is contained in:
@@ -26,9 +26,8 @@ func TestExtractReplicationMetadataPreservesNormalizedMetadata(t *testing.T) {
|
||||
{name: "gzip", wire: []string{"gzip"}, want: "gzip"},
|
||||
{name: "transport-last", wire: []string{"gzip,aws-chunked"}, want: "gzip"},
|
||||
{name: "multiple-values", wire: []string{"aws-chunked", "gzip"}, want: "gzip"},
|
||||
// Preserve the existing exact-token grammar; whitespace is not normalized here.
|
||||
{name: "space-before-gzip", wire: []string{"aws-chunked, gzip"}, want: " gzip"},
|
||||
{name: "space-before-transport", wire: []string{"gzip, aws-chunked"}, want: "gzip, aws-chunked"},
|
||||
{name: "space-before-gzip", wire: []string{"aws-chunked, gzip"}, want: "gzip"},
|
||||
{name: "space-before-transport", wire: []string{"gzip, aws-chunked"}, want: "gzip"},
|
||||
} {
|
||||
for _, lowercase := range []bool{false, true} {
|
||||
name := tc.name + "/canonical"
|
||||
|
||||
Reference in New Issue
Block a user