From ec27f41934e0c7072771df8cc0239eb5d67ae69d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 10 Feb 2020 18:34:30 -0800 Subject: [PATCH] fix: avoid filtering by prefix unless necessary There's no need to filter by the / prefix. --- query/query_impl.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/query/query_impl.go b/query/query_impl.go index 8faba34..dd554e7 100644 --- a/query/query_impl.go +++ b/query/query_impl.go @@ -129,12 +129,10 @@ func NaiveQueryApply(q Query, qr Results) Results { } prefix = path.Clean(prefix) } - // If the prefix isn't "/", end it in a "/" so we only find keys - // _under_ the prefix. + // If the prefix is empty, ignore it. if prefix != "/" { - prefix += "/" + qr = NaiveFilter(qr, FilterKeyPrefix{prefix + "/"}) } - qr = NaiveFilter(qr, FilterKeyPrefix{prefix}) } for _, f := range q.Filters { qr = NaiveFilter(qr, f)