Skip to content

Commit

Permalink
fix: avoid filtering by prefix unless necessary
Browse files Browse the repository at this point in the history
There's no need to filter by the / prefix.
  • Loading branch information
Stebalien committed Feb 11, 2020
1 parent b72ac7e commit ec27f41
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions query/query_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ec27f41

Please sign in to comment.