From 8e99c83b19d21cc1b245a91a9ac56812172d9bc9 Mon Sep 17 00:00:00 2001 From: Chenyu Zhang Date: Thu, 23 Jun 2022 19:12:48 +0800 Subject: [PATCH] fix: fix the update of retention policy (#17064) Signed-off-by: chlins --- src/server/v2.0/handler/retention.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/v2.0/handler/retention.go b/src/server/v2.0/handler/retention.go index 30925f0fe..938ea8e81 100644 --- a/src/server/v2.0/handler/retention.go +++ b/src/server/v2.0/handler/retention.go @@ -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)) }