@devries-cameron20 / t3code-1 / commits / e018563669
Fork 0

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

fix(desktop): keep WSL distros whose names start or end with a dot or hyphen (#35971)

Julius Marminge committed Nov 12, 2026 at 21:00 UTC e01856366962ddaa6917a05b18c7431d39c88f0e
2 files changed +16 -4
apps/desktop/src/wsl/wslPathParsing.test.ts
+14 -3
@@ -77,8 +77,15 @@ describe("wslUncPathToLinuxPath", () => {
77 expect(wslUncPathToLinuxPath("\\\\wsl.localhost\\Debian\\")).toBe("/");
78 });
79
80 + it("maps UNC paths of distros whose names start or end with a dot or hyphen", () => {
81 + for (const name of ["Ubuntu-", "Ubuntu.", ".Ubuntu", "-Ubuntu"]) {
82 + expect(wslUncPathToLinuxPath(`\\\\wsl.localhost\\${name}\\home\\josh`)).toBe("/home/josh");
83 + }
84 + });
85 +
86 it("rejects invalid distro names and non-WSL paths", () => {
87 expect(wslUncPathToLinuxPath("\\\\wsl.localhost\\bad!name\\home")).toBeNull();
88 + expect(wslUncPathToLinuxPath("\\\\wsl.localhost\\..\\home")).toBeNull();
89 expect(wslUncPathToLinuxPath("C:\\Users\\Josh\\repo")).toBeNull();
90 });
91 });
@@ -107,9 +114,13 @@ describe("resolveWslPickFolderDefaultPath", () => {
114 });
115
116 describe("isValidDistroName", () => {
110 - it("rejects names with trailing whitespace, hyphen, or dot", () => {
111 - for (const name of ["Ubuntu ", "Ubuntu-", "Ubuntu."]) {
112 - expect(isValidDistroName(name)).toBe(false);
117 + it("rejects names with trailing whitespace", () => {
118 + expect(isValidDistroName("Ubuntu ")).toBe(false);
119 + });
120 +
121 + it("accepts names WSL registers with a leading or trailing dot or hyphen", () => {
122 + for (const name of ["Ubuntu-", "Ubuntu.", ".Ubuntu", "-Ubuntu"]) {
123 + expect(isValidDistroName(name)).toBe(true);
124 }
125 });
126
apps/desktop/src/wsl/wslPathParsing.ts
+2 -1
@@ -9,7 +9,8 @@ export interface WslConfig {
9 }
10
11 // Literal spaces only; \s would accept controls and corrupt UNC distro paths.
12 -const DISTRO_NAME_PATTERN = /^\w(?:[\w \-.]*\w)?$/;
12 +// "." and ".." would be path segments in a UNC path, not distro names.
13 +const DISTRO_NAME_PATTERN = /^(?!\.{1,2}$)[\w.-](?:[\w .-]*[\w.-])?$/;
14
15 export function parseWslDistroList(stdout: Buffer): readonly WslDistro[] {
16 const hasUtf16Bom = stdout.length >= 2 && stdout[0] === 0xff && stdout[1] === 0xfe;