diff --git a/api/layer/layer.go b/api/layer/layer.go index 6d14ebdec..894ae3b2f 100644 --- a/api/layer/layer.go +++ b/api/layer/layer.go @@ -531,11 +531,10 @@ func (n *layer) removeVersionIfFound(ctx context.Context, bkt *data.BucketInfo, var deleteMarkVersion string if version.DeleteMarker != nil { deleteMarkVersion = obj.VersionID - } - - if err := n.objectDelete(ctx, bkt, version.OID); err != nil { + } else if err := n.objectDelete(ctx, bkt, version.OID); err != nil { return deleteMarkVersion, err } + return deleteMarkVersion, n.treeService.RemoveVersion(ctx, &bkt.CID, version.ID) }