From 94731cfa50ddd1469e64b2633d78b5072ddf8f8f Mon Sep 17 00:00:00 2001 From: shilangyu Date: Fri, 2 Feb 2024 17:06:30 +0100 Subject: [PATCH] Correctly handle empty query string --- src/search.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search.zig b/src/search.zig index 73fe12c..a679351 100644 --- a/src/search.zig +++ b/src/search.zig @@ -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