From 0e4a77d95127704edf8ba21d95811fdbcf56857b Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 12 Nov 2026 09:22:30 +0000 Subject: [PATCH 1/2] test(web): failing case for backslash file names in the Changes card tree Reproduces pingdotgg/t3code#35017. AI-assisted; verified with the tests and tools listed above. --- apps/web/src/lib/turnDiffTree.test.ts | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/apps/web/src/lib/turnDiffTree.test.ts b/apps/web/src/lib/turnDiffTree.test.ts index bf792a803238c..15340c8e8bfdf 100644 --- a/apps/web/src/lib/turnDiffTree.test.ts +++ b/apps/web/src/lib/turnDiffTree.test.ts @@ -138,4 +138,34 @@ describe("buildTurnDiffTree", () => { }, ]); }); + + it("keeps a literal backslash in a POSIX file name instead of splitting it into a folder", () => { + expect( + buildTurnDiffTree([ + { path: "back\\slash.txt", kind: "modified", additions: 1, deletions: 0 }, + { path: "back/slash.txt", kind: "modified", additions: 2, deletions: 0 }, + ]), + ).toEqual([ + { + kind: "directory", + name: "back", + path: "back", + stat: { additions: 2, deletions: 0 }, + children: [ + { + kind: "file", + name: "slash.txt", + path: "back/slash.txt", + stat: { additions: 2, deletions: 0 }, + }, + ], + }, + { + kind: "file", + name: "back\\slash.txt", + path: "back\\slash.txt", + stat: { additions: 1, deletions: 0 }, + }, + ]); + }); }); From 5ce23c0ade10cf844b86516feb00dca00cc5f238 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 12 Nov 2026 09:30:29 +0000 Subject: [PATCH 2/2] fix(web): file names with a backslash no longer split into folders in the Changes card Fixes pingdotgg/t3code#35017 AI-assisted; verified with the tests and tools listed above. --- apps/web/src/lib/turnDiffTree.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/web/src/lib/turnDiffTree.ts b/apps/web/src/lib/turnDiffTree.ts index 7d491e15ccfb5..7cceba0137847 100644 --- a/apps/web/src/lib/turnDiffTree.ts +++ b/apps/web/src/lib/turnDiffTree.ts @@ -33,10 +33,7 @@ interface MutableDirectoryNode { let sortCollator: Intl.Collator | undefined; function normalizePathSegments(pathValue: string): string[] { - return pathValue - .replaceAll("\\", "/") - .split("/") - .filter((segment) => segment.length > 0); + return pathValue.split("/").filter((segment) => segment.length > 0); } function compareByName(a: { name: string }, b: { name: string }): number {