fix object lock metadata filter (#20011)

This commit is contained in:
Poorna 2024-06-28 18:20:27 -07:00 committed by GitHub
parent f365a98029
commit 68a9f521d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -572,6 +572,7 @@ func FilterObjectLockMetadata(metadata map[string]string, filterRetention, filte
dst := metadata dst := metadata
var copied bool var copied bool
delKey := func(key string) { delKey := func(key string) {
key = strings.ToLower(key)
if _, ok := metadata[key]; !ok { if _, ok := metadata[key]; !ok {
return return
} }

View File

@ -606,7 +606,7 @@ func TestFilterObjectLockMetadata(t *testing.T) {
for i, tt := range tests { for i, tt := range tests {
o := FilterObjectLockMetadata(tt.metadata, tt.filterRetention, tt.filterLegalHold) o := FilterObjectLockMetadata(tt.metadata, tt.filterRetention, tt.filterLegalHold)
if !reflect.DeepEqual(o, tt.metadata) { if !reflect.DeepEqual(o, tt.expected) {
t.Fatalf("Case %d expected %v, got %v", i, tt.metadata, o) t.Fatalf("Case %d expected %v, got %v", i, tt.metadata, o)
} }
} }