[#99] Fix no-root search matcher

Wrong boolean operation order made matcher return false
on `non-root` search query with non-regular objects. Instead
it should return true for `non-root` query and false for `root`
query.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
remotes/KirillovDenis/release/v0.21.1
Alex Vanin 2020-10-16 13:36:00 +03:00 committed by Alex Vanin
parent d4461b9493
commit 719075ca97
1 changed files with 2 additions and 2 deletions

View File

@ -45,8 +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() &&
obj.GetType() == objectSDK.TypeRegular
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)
}