From cb5237fb8222fb7dbef831e10047996bbca7e95b Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 7 Jun 2022 18:34:43 +0300 Subject: [PATCH] [#510] Fix listing with prefix Signed-off-by: Denis Kirillov --- internal/neofs/tree.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/neofs/tree.go b/internal/neofs/tree.go index f4310624f..32cf9b0ab 100644 --- a/internal/neofs/tree.go +++ b/internal/neofs/tree.go @@ -563,7 +563,7 @@ func (c *TreeClient) GetLatestVersionsByPrefix(ctx context.Context, cnrID *cid.I func (c *TreeClient) determinePrefixNode(ctx context.Context, cnrID *cid.ID, treeID, prefix string) (uint64, string, error) { var rootID uint64 path := strings.Split(prefix, separator) - if path[0] == "" { + if len(path) > 1 && path[0] == "" { path[0] = emptyFileName } tailPrefix := path[len(path)-1] @@ -594,7 +594,7 @@ func (c *TreeClient) getPrefixNodeID(ctx context.Context, cnrID *cid.ID, treeID var intermediateNodes []uint64 for _, node := range nodes { - if !isIntermediate(node) { + if isIntermediate(node) { intermediateNodes = append(intermediateNodes, node.GetNodeId()) } }