@devries-cameron20 / t3code Mirror · read-only / commits / 6befe42eb0
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 17:45 UTC

fix(shared): normalize a bare Windows drive root the same as C:\ / C:/ (#6189)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Arham Amin committed Aug 11, 2026 at 21:22 UTC 6befe42eb09633f3adb500ae906a0e1da3f15f64
2 files changed +17 -1
packages/shared/src/path.test.ts
+12
@@ -4,6 +4,8 @@ import {
4 isUncPath,
5 isWindowsAbsolutePath,
6 isWindowsDrivePath,
7 + normalizeProjectPathForComparison,
8 + normalizeProjectPathForDispatch,
9 } from "./path.ts";
10
11 describe("path helpers", () => {
@@ -31,4 +33,14 @@ describe("path helpers", () => {
33 expect(isExplicitRelativePath("..\\repo")).toBe(true);
34 expect(isExplicitRelativePath("~/repo")).toBe(false);
35 });
36 +
37 + it("normalizes a bare Windows drive root the same as one with a trailing separator", () => {
38 + // `C:`, `C:\` and `C:/` all refer to the drive root and must compare equal.
39 + expect(normalizeProjectPathForDispatch("C:")).toBe("C:\\");
40 + expect(normalizeProjectPathForComparison("C:")).toBe("c:\\");
41 + expect(normalizeProjectPathForComparison("C:")).toBe(normalizeProjectPathForComparison("C:\\"));
42 + expect(normalizeProjectPathForComparison("C:")).toBe(normalizeProjectPathForComparison("C:/"));
43 + // Non-root drive paths keep their trailing separator trimmed as before.
44 + expect(normalizeProjectPathForDispatch("C:\\repo\\")).toBe("C:\\repo");
45 + });
46 });
packages/shared/src/path.ts
+5 -1
@@ -22,7 +22,11 @@ export function isExplicitRelativePath(value: string): boolean {
22 }
23
24 function isRootPath(value: string): boolean {
25 - return value === "/" || value === "\\" || /^[a-zA-Z]:[/\\]?$/.test(value);
25 + // The drive separator is required: a bare `C:` is not the drive root (it
26 + // means "current directory on C:"), and treating it as already-canonical
27 + // would leave it as `C:` while `C:\` and `C:/` normalize to the drive root,
28 + // so the same location would fail project identity/dedup comparisons.
29 + return value === "/" || value === "\\" || /^[a-zA-Z]:[/\\]$/.test(value);
30 }
31
32 function trimTrailingPathSeparators(value: string): string {