Disallow delete replication for tag based rules (#14167)

This commit is contained in:
Poorna
2022-01-24 15:22:20 -08:00
committed by GitHub
parent 5a9f133491
commit 295730408b
2 changed files with 6 additions and 0 deletions

View File

@@ -153,6 +153,7 @@ var (
errDeleteReplicationMissing = Errorf("Delete replication must be specified")
errInvalidDeleteReplicationStatus = Errorf("Delete replication is either enable|disable")
errInvalidExistingObjectReplicationStatus = Errorf("Existing object replication status is invalid")
errTagsDeleteMarkerReplicationDisallowed = Errorf("Delete marker replication is not supported if any Tag filter is specified")
)
// validateID - checks if ID is valid or not.
@@ -239,6 +240,9 @@ func (r Rule) Validate(bucket string, sameTarget bool) error {
if r.Destination.Bucket == bucket && sameTarget {
return errDestinationSourceIdentical
}
if !r.Filter.Tag.IsEmpty() && (r.DeleteMarkerReplication.Status == Enabled) {
return errTagsDeleteMarkerReplicationDisallowed
}
return r.ExistingObjectReplication.Validate()
}