fix: replication of tags while removing (#17989)

A tag removal was not being replicated prior to this change
This commit is contained in:
Poorna 2023-09-06 19:05:02 -07:00 committed by GitHub
parent f7ca6c63c2
commit 703ed46d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -702,10 +702,8 @@ func getCopyObjMetadata(oi ObjectInfo, sc string) map[string]string {
meta[xhttp.ContentType] = oi.ContentType
}
if oi.UserTags != "" {
meta[xhttp.AmzObjectTagging] = oi.UserTags
meta[xhttp.AmzTagDirective] = "REPLACE"
}
meta[xhttp.AmzObjectTagging] = oi.UserTags
meta[xhttp.AmzTagDirective] = "REPLACE"
if sc == "" {
sc = oi.StorageClass
@ -887,7 +885,7 @@ func getReplicationAction(oi1 ObjectInfo, oi2 minio.ObjectInfo, opType replicati
}
t, _ := tags.ParseObjectTags(oi1.UserTags)
if !reflect.DeepEqual(oi2.UserTags, t.ToMap()) || (oi2.UserTagCount != len(t.ToMap())) {
if (oi2.UserTagCount > 0 && !reflect.DeepEqual(oi2.UserTags, t.ToMap())) || (oi2.UserTagCount != len(t.ToMap())) {
return replicateMetadata
}