Fixed possible NPE in PutObject

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
Evgeniy Kulikov 2020-08-20 02:30:18 +03:00
parent 447a255d18
commit fb00af23fb

View file

@ -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()