The best way to control Claude Code, Codex and more from any computer or phone
fix(shared): match Windows home paths case-insensitively in file links (#19627)
Co-authored-by: hogeheer499-commits <267467744+hogeheer499-commits@users.noreply.github.com>
Jesse van Dijk committed
Oct 18, 2026 at 21:26 UTC
0a712f0cdc5652ce99a6c3af286ea5859a9cab4a
2 files changed
+8
-1
packages/shared/src/fileLinks.test.ts
+7
@@ -66,7 +66,14 @@ describe("resolvePathLinkTarget", () => {
66
it.each([
67
["C:\\Users\\julius\\project", "C:\\Users\\julius\\notes.md:3"],
68
["C:/Users/julius/project", "C:/Users/julius\\notes.md:3"],
69
+ ["C:\\users\\alice\\project", "C:\\users\\alice\\notes.md:3"],
70
+ ["C:/uSeRs/alice/project", "C:/uSeRs/alice\\notes.md:3"],
71
])("resolves home paths against the Windows cwd %s", (cwd, expected) => {
72
expect(resolvePathLinkTarget("~/notes.md:3", cwd)).toBe(expected);
73
});
74
+ it("keeps home paths unchanged when no supported home can be inferred", () => {
75
+ for (const cwd of ["C:/work/project", "/Home/alice/project", "/users/alice/project"]) {
76
+ expect(resolvePathLinkTarget("~/notes.md:3", cwd)).toBe("~/notes.md:3");
77
+ }
78
+ });
79
});
packages/shared/src/fileLinks.ts
+1
-1
@@ -80,7 +80,7 @@ function inferHomeFromCwd(cwd: string): string | undefined {
80
return `/home/${posixHome[1]}`;
81
}
82
83
- const windowsUser = cwd.match(/^([A-Za-z]:[\\/]Users[\\/][^\\/]+)/);
83
+ const windowsUser = cwd.match(/^([A-Za-z]:[\\/]Users[\\/][^\\/]+)/i);
84
if (windowsUser?.[1]) {
85
return windowsUser[1];
86
}