Skip to content

Commit 6952c49

Browse files
fix(web): file breadcrumbs keep backslashes in POSIX folder names
Fixes #34716 AI-assisted; verified with the tests and tools listed above.
1 parent 52760c0 commit 6952c49

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/web/src/components/files/filePath.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ export interface FileBreadcrumbChild extends ProjectEntry {
1313

1414
export function fileBreadcrumbs(projectName: string, relativePath: string): FileBreadcrumb[] {
1515
const hostPath = isHostPath(relativePath);
16-
const separator = isWindowsAbsolutePath(relativePath) ? "\\" : "/";
17-
const parts = relativePath.split(/[\\/]/).filter(Boolean);
16+
const windowsPath = isWindowsAbsolutePath(relativePath);
17+
const separator = windowsPath ? "\\" : "/";
18+
// `\` is a legal filename character outside Windows paths.
19+
const parts = relativePath.split(windowsPath ? /[\\/]/ : "/").filter(Boolean);
1820
const root = relativePath.startsWith("\\\\") ? "\\\\" : relativePath.startsWith("/") ? "/" : "";
1921
return [
2022
...(hostPath ? [] : [{ label: projectName, path: "", kind: "project" as const }]),

0 commit comments

Comments
 (0)