From c85bea15efc60a3f3b76df359a96162a950e3d68 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 9 Nov 2022 19:12:39 +0300 Subject: [PATCH] [#1978] cli: Add children to the static session on `DELETE` If an external session is provided and is not opened by CLI itself, add children objects to it too. It fixes "not found" errors when removing a big object with a predefined session (from a file). Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/object/util.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/neofs-cli/modules/object/util.go b/cmd/neofs-cli/modules/object/util.go index 7a6d5014..9436b18e 100644 --- a/cmd/neofs-cli/modules/object/util.go +++ b/cmd/neofs-cli/modules/object/util.go @@ -225,6 +225,12 @@ func ReadOrOpenSessionViaClient(cmd *cobra.Command, dst SessionPrm, cli *client. var objs []oid.ID if obj != nil { objs = []oid.ID{*obj} + + if _, ok := dst.(*internal.DeleteObjectPrm); ok { + common.PrintVerbose("Collecting relatives of the removal object...") + + objs = append(objs, collectObjectRelatives(cmd, cli, cnr, *obj)...) + } } finalizeSession(cmd, dst, tok, key, cnr, objs...)