[#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 <alexey@nspcc.ru>
remotes/KirillovDenis/release/v0.21.1
Alex Vanin 2020-10-05 13:17:08 +03:00 committed by Alex Vanin
parent 11262bed4a
commit 7a2654719e
1 changed files with 2 additions and 1 deletions

View File

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