Skip to content

Commit 2b5cc46

Browse files
committed
Fix pathToProjectSlug on Windows
resolve() on Windows returns backslash-separated paths (D:\a\foo), and the slug regex only replaced forward slashes, leaving backslashes unchanged in the output. Normalize \ to / before slugging so test-cli (windows-latest) passes.
1 parent 3fa1c40 commit 2b5cc46

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

cli/src/commands/session/tokens.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ export function pathToProjectSlug(input: string): string {
100100
isAbsolute(input) || input.startsWith("./") || input.startsWith("../");
101101
if (looksLikePath) {
102102
const abs = isAbsolute(input) ? input : resolve(input);
103-
return abs.replace(/\/+$/, "").replace(/[./]/g, "-");
103+
// Normalize Windows separators so the slug logic (which encodes `/` and
104+
// `.` as `-`) produces identical output on all platforms. Without this,
105+
// `resolve("./foo")` on Windows returns `D:\...\foo` and the backslashes
106+
// leak through unchanged.
107+
const normalized = abs.replace(/\\/g, "/");
108+
return normalized.replace(/\/+$/, "").replace(/[./]/g, "-");
104109
}
105110
return input;
106111
}

0 commit comments

Comments
 (0)