From b6a43c6f4c8f8c7525ef18bd0eef5d3d13ca36e2 Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Wed, 25 May 2022 12:10:43 +0400 Subject: [PATCH] [#449] Replace error checks and literals Signed-off-by: Angira Kekteeva --- api/layer/tagging.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/api/layer/tagging.go b/api/layer/tagging.go index 7ead9d4fb..97301f2d4 100644 --- a/api/layer/tagging.go +++ b/api/layer/tagging.go @@ -3,8 +3,6 @@ package layer import ( "context" errorsStd "errors" - "strings" - "github.com/nspcc-dev/neofs-s3-gw/api/data" "github.com/nspcc-dev/neofs-s3-gw/api/errors" cid "github.com/nspcc-dev/neofs-sdk-go/container/id" @@ -134,16 +132,16 @@ func (n *layer) getTaggedObjectVersion(ctx context.Context, p *data.ObjectTaggin version *data.NodeVersion ) - if p.VersionID == "null" { + if p.VersionID == unversionedObjectVersionID { if version, err = n.treeService.GetUnversioned(ctx, p.CnrID, p.ObjName); err != nil { - if strings.Contains(err.Error(), "not found") { + if errorsStd.Is(err, ErrNodeNotFound) { return nil, errors.GetAPIError(errors.ErrNoSuchKey) } return nil, err } } else if len(p.VersionID) == 0 { if version, err = n.treeService.GetLatestVersion(ctx, p.CnrID, p.ObjName); err != nil { - if strings.Contains(err.Error(), "not found") { + if errorsStd.Is(err, ErrNodeNotFound) { return nil, errors.GetAPIError(errors.ErrNoSuchKey) } return nil, err