Skip to content

Commit

Permalink
Merge pull request #50 from shilangyu/fix/empty-query
Browse files Browse the repository at this point in the history
Correctly handle empty query string
  • Loading branch information
shilangyu authored Feb 12, 2024
2 parents 2ce1cbb + 94731cf commit 86dc372
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/search.zig
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ fn matchPackageAux(packagesDir: std.fs.Dir, query: []const u8, manifestName: []c
defer allocator.free(lowerStem);

// does the package name match?
if (std.mem.containsAtLeast(u8, lowerStem, 1, query)) {
if (query.len == 0 or std.mem.containsAtLeast(u8, lowerStem, 1, query)) {
try state.matches.append(try SearchMatch.init(allocator, stem, version, null));
} else {
// the name did not match, lets see if any binary files do
Expand Down

0 comments on commit 86dc372

Please sign in to comment.