Skip to content

Commit ec27f41

Browse files
committed
fix: avoid filtering by prefix unless necessary
There's no need to filter by the / prefix.
1 parent b72ac7e commit ec27f41

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

query/query_impl.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,10 @@ func NaiveQueryApply(q Query, qr Results) Results {
129129
}
130130
prefix = path.Clean(prefix)
131131
}
132-
// If the prefix isn't "/", end it in a "/" so we only find keys
133-
// _under_ the prefix.
132+
// If the prefix is empty, ignore it.
134133
if prefix != "/" {
135-
prefix += "/"
134+
qr = NaiveFilter(qr, FilterKeyPrefix{prefix + "/"})
136135
}
137-
qr = NaiveFilter(qr, FilterKeyPrefix{prefix})
138136
}
139137
for _, f := range q.Filters {
140138
qr = NaiveFilter(qr, f)

0 commit comments

Comments
 (0)