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

Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
Chenyu Zhang 2022-06-23 19:12:35 +08:00 committed by GitHub
parent f87803b5a4
commit 003d3bcfbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

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))
}