mirror of
https://github.com/versity/versitygw.git
synced 2026-07-22 16:03:22 +00:00
fix: omit null version id for suspended buckets
Keep null as the stored object version ID when bucket versioning is suspended, but omit x-amz-version-id from the PutObject response to match Amazon S3. Update the existing versioning integration coverage to distinguish the PutObject response from the null version returned by ListObjectVersions, and verify empty response headers are not rendered. Fixes #2164 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -198,9 +198,10 @@ func TestSetResponseHeaders(t *testing.T) {
|
||||
headers map[string]*string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expected map[string]string
|
||||
name string
|
||||
args args
|
||||
expected map[string]string
|
||||
unexpected []string
|
||||
}{
|
||||
{
|
||||
name: "should not set if map is nil",
|
||||
@@ -215,7 +216,7 @@ func TestSetResponseHeaders(t *testing.T) {
|
||||
headers: map[string]*string{
|
||||
"x-amz-checksum-algorithm": utils.GetStringPtr("crc32"),
|
||||
"x-amz-meta-key": utils.GetStringPtr("meta_key"),
|
||||
"x-amz-mp-size": utils.GetStringPtr(""),
|
||||
"x-amz-version-id": utils.GetStringPtr(""),
|
||||
"something": nil,
|
||||
},
|
||||
},
|
||||
@@ -223,6 +224,7 @@ func TestSetResponseHeaders(t *testing.T) {
|
||||
"x-amz-checksum-algorithm": "crc32",
|
||||
"x-amz-meta-key": "meta_key",
|
||||
},
|
||||
unexpected: []string{"x-amz-version-id", "something"},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -236,6 +238,9 @@ func TestSetResponseHeaders(t *testing.T) {
|
||||
assert.Equal(t, val, string(v))
|
||||
}
|
||||
}
|
||||
for _, key := range tt.unexpected {
|
||||
assert.Empty(t, ctx.Response().Header.Peek(key))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user