fix: fix the update of retention policy (#17064)

Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
Chenyu Zhang 2022-06-23 19:12:48 +08:00 committed by GitHub
parent b11970ac3c
commit 8e99c83b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -384,10 +384,10 @@ func (r *retentionAPI) requirePolicyAccess(ctx context.Context, p *policy.Metada
// validate
if len(meta["retention_id"]) > 0 {
// return err if retention id does not match
if meta["retention_id"] != fmt.Sprintf("%d", p.ID) {
return errors.NotFoundError(errors.Errorf("the retention policy id %d does not match", p.ID))
if meta["retention_id"] == fmt.Sprintf("%d", p.ID) {
return nil
}
}
return nil
return errors.NotFoundError(errors.Errorf("the retention policy id %d does not match", p.ID))
}