From fb00af23fb09c99b6dec76f04041cbc5b9f4c214 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 20 Aug 2020 02:30:18 +0300 Subject: [PATCH] Fixed possible NPE in PutObject Signed-off-by: Evgeniy Kulikov --- api/layer/layer.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/layer/layer.go b/api/layer/layer.go index 79994edde..80a05b972 100644 --- a/api/layer/layer.go +++ b/api/layer/layer.go @@ -288,7 +288,10 @@ func (n *layer) PutObject(ctx context.Context, p *PutObjectParams) (*ObjectInfo, _, err = n.objectFindID(ctx, cid, p.Object, true) if err == nil { - return nil, err + return nil, &api.ObjectAlreadyExists{ + Bucket: p.Bucket, + Object: p.Object, + } } oid, err := refs.NewObjectID()