Skip to content

Commit

Permalink
fix replication validation for Role ARN (#1978)
Browse files Browse the repository at this point in the history
  • Loading branch information
poornas authored Jun 26, 2024
1 parent b28095b commit e0ba2df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/replication/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ func (c *Config) EditRule(opts Options) error {
return fmt.Errorf("priority must be unique. Replication configuration already has a rule with this priority")
}
if rule.Destination.Bucket != newRule.Destination.Bucket && rule.ID == newRule.ID {
if c.Role == newRule.Destination.Bucket {
continue
}
return fmt.Errorf("invalid destination bucket for this rule")
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/replication/replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func TestEditReplicationRule(t *testing.T) {
StorageClass: "STANDARD",
DestBucket: "arn:minio:replication:eu-west-1:c5acb6ac-9918-4dc6-8534-6244ed1a611a:destbucket",
},
expectedErr: "invalid destination bucket for this rule",
expectedErr: "",
},
{ // test case :2 mismatched rule id
cfg: Config{
Expand Down

0 comments on commit e0ba2df

Please sign in to comment.