Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(which/windows): ignore file extension case #10102

Merged
merged 10 commits into from
Apr 15, 2024
2 changes: 1 addition & 1 deletion src/which.zig
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn endsWithExtension(str: []const u8) bool {
const file_ext = str[str.len - 3 ..];
inline for (win_extensions) |ext| {
comptime bun.assert(ext.len == 3);
if (bun.strings.eqlComptimeCheckLenWithType(u8, file_ext, ext, false)) return true;
if (bun.strings.eqlCaseInsensitiveASCIIICheckLength(file_ext, ext)) return true;
}
return false;
}
Expand Down
1 change: 1 addition & 0 deletions test/js/bun/util/which.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if (isWindows) {
test("which", () => {
expect(which("cmd")).toBe("C:\\Windows\\system32\\cmd.exe");
expect(which("cmd.exe")).toBe("C:\\Windows\\system32\\cmd.exe");
expect(which("cmd.EXE")).toBe("C:\\Windows\\system32\\cmd.EXE");
expect(which("cmd.bat")).toBe(null);
const exe = basename(process.execPath);
const dir = join(process.execPath, "../");
Expand Down
Loading