From 7a2654719e85cbbaf1550bc4deba2d1fd984a3d0 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 5 Oct 2020 13:17:08 +0300 Subject: [PATCH] [#71] Return only regular objects in root object search Root search applies for user objects, so it should not return tombstones and storage groups. Signed-off-by: Alex Vanin --- pkg/services/object/search/query/v1/v1.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/services/object/search/query/v1/v1.go b/pkg/services/object/search/query/v1/v1.go index c8f4e910a..0b704d37c 100644 --- a/pkg/services/object/search/query/v1/v1.go +++ b/pkg/services/object/search/query/v1/v1.go @@ -45,7 +45,8 @@ func (q *Query) Match(obj *object.Object, handler func(*objectSDK.ID)) { default: match = headerEqual(obj, key, q.filters[i].Value()) case objectSDK.KeyRoot: - match = (q.filters[i].Value() == objectSDK.ValRoot) == !obj.HasParent() + match = (q.filters[i].Value() == objectSDK.ValRoot) == !obj.HasParent() && + obj.GetType() == objectSDK.TypeRegular case objectSDK.KeyLeaf: match = (q.filters[i].Value() == objectSDK.ValLeaf) == (par == nil) }