diff --git a/internal/bucket/replication/replication.go b/internal/bucket/replication/replication.go index dc94d7052..206dc1741 100644 --- a/internal/bucket/replication/replication.go +++ b/internal/bucket/replication/replication.go @@ -62,6 +62,12 @@ func ParseConfig(reader io.Reader) (*Config, error) { }, } } + // Default DeleteReplication to disabled if unset. + if len(config.Rules[i].DeleteReplication.Status) == 0 { + config.Rules[i].DeleteReplication = DeleteReplication{ + Status: Disabled, + } + } } return &config, nil } diff --git a/internal/bucket/replication/replication_test.go b/internal/bucket/replication/replication_test.go index 71dc1a43a..a83ae4cc9 100644 --- a/internal/bucket/replication/replication_test.go +++ b/internal/bucket/replication/replication_test.go @@ -38,13 +38,13 @@ func TestParseAndValidateReplicationConfig(t *testing.T) { expectedParsingErr: nil, expectedValidationErr: errInvalidDeleteMarkerReplicationStatus, }, - // 2 Invalid delete replication status in replication config + // 2 No delete replication status in replication config { inputConfig: `arn:aws:iam::AcctID:role/role-nameEnabledDisabledkey-prefixarn:aws:s3:::destinationbucket`, destBucket: "destinationbucket", sameTarget: false, expectedParsingErr: nil, - expectedValidationErr: errDeleteReplicationMissing, + expectedValidationErr: nil, }, // 3 valid replication config {