@devries-cameron20 / t3code Mirror · read-only / commits / 20ef25037f
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, 02:45 UTC

fix(editors): accept root paths and Windows servers in Zed remote links (#11044)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

maria committed Sep 10, 2026 at 23:39 UTC 20ef25037f455a570426ac2a93fcf499d1f91167
4 files changed +31 -9
apps/desktop/src/electron/ElectronShell.test.ts
+9 -3
@@ -93,10 +93,16 @@ describe("ElectronShell", () => {
93 openExternalMock.mockResolvedValue(undefined);
94
95 const electronShell = yield* ElectronShell.ElectronShell;
96 - const result = yield* electronShell.openExternal("zed://ssh/example.com/home/user/project");
96 + const results = yield* Effect.all([
97 + electronShell.openExternal("zed://ssh/example.com/home/user/project"),
98 + electronShell.openExternal("zed://ssh/example.com/"),
99 + ]);
100
98 - assert.equal(result, true);
99 - assert.deepEqual(openExternalMock.mock.calls, [["zed://ssh/example.com/home/user/project"]]);
101 + assert.deepEqual(results, [true, true]);
102 + assert.deepEqual(openExternalMock.mock.calls, [
103 + ["zed://ssh/example.com/home/user/project"],
104 + ["zed://ssh/example.com/"],
105 + ]);
106 }).pipe(Effect.provide(ElectronShell.layer)),
107 );
108
apps/desktop/src/electron/ElectronShell.ts
+1 -1
@@ -36,7 +36,7 @@ const REMOTE_EDITOR_PROTOCOLS = new Set(
36 );
37
38 // Zed's host sits in the first path segment, so it needs its own userinfo ban.
39 -const ZED_SSH_PATHNAME = /^\/[^/@:]+\/.+$/;
39 +const ZED_SSH_PATHNAME = /^\/[^/@:]+\/.*$/;
40
41 const isRemoteEditorUrl = (url: URL) =>
42 REMOTE_EDITOR_PROTOCOLS.has(url.protocol) &&
apps/web/src/remoteOpen.test.ts
+9
@@ -151,6 +151,15 @@ describe("buildRemoteOpenUrl", () => {
151 ).toBe("zed://ssh/sol.tail1234.ts.net/home/theo/code/my%20repo");
152 });
153
154 + it("drops the Windows drive letter for Zed", () => {
155 + expect(
156 + buildRemoteOpenUrl({ editor: "zed", host: "sol", absolutePath: "C:\\Users\\theo" }),
157 + ).toBe("zed://ssh/sol/Users/theo");
158 + expect(buildRemoteOpenUrl({ editor: "zed", host: "sol", absolutePath: "/C:/project" })).toBe(
159 + "zed://ssh/sol/C%3A/project",
160 + );
161 + });
162 +
163 it("returns undefined for editors without remote support", () => {
164 expect(buildRemoteOpenUrl({ editor: "idea", host: "sol", absolutePath: "/tmp/x" })).toBe(
165 undefined,
packages/contracts/src/editor.ts
+12 -5
@@ -91,7 +91,7 @@ export type LaunchEditorInput = typeof LaunchEditorInput.Type;
91
92 const remoteSchemeOf = (editor: EditorDefinition): string | undefined => editor.remoteScheme;
93
94 -/** Editors that can open a remote workspace via `vscode-remote` deep links. */
94 +/** Editors that can open a remote workspace via an SSH deep link. */
95 export const REMOTE_CAPABLE_EDITOR_IDS: ReadonlyArray<EditorId> = EDITORS.flatMap((editor) =>
96 remoteSchemeOf(editor) !== undefined ? [editor.id] : [],
97 );
@@ -119,11 +119,18 @@ export const buildRemoteOpenUrl = (input: {
119 // Windows server paths (`C:\...`) appear as `/C:/...` in vscode-remote URIs.
120 const posixPath = input.absolutePath.replaceAll("\\", "/");
121 const rootedPath = posixPath.startsWith("/") ? posixPath : `/${posixPath}`;
122 - const encodedPath = rootedPath.split("/").map(encodeURIComponent).join("/");
122 const encodedHost = encodeURIComponent(input.host);
124 - return input.editor === "zed"
125 - ? `${scheme}://ssh/${encodedHost}${encodedPath}`
126 - : `${scheme}://vscode-remote/ssh-remote+${encodedHost}${encodedPath}`;
123 + if (input.editor === "zed") {
124 + // Zed's remote server resolves a rooted path on the system drive, so a
125 + // Windows `C:\Users\x` must become `/Users/x` (verified in #8938). Other
126 + // drives are untested and kept as is rather than silently remapped, and a
127 + // POSIX path that happens to start with `/C:` is left alone.
128 + const zedPath = /^[Cc]:[\\/]/.test(input.absolutePath) ? rootedPath.slice(3) : rootedPath;
129 + const encodedZedPath = zedPath.split("/").map(encodeURIComponent).join("/");
130 + return `${scheme}://ssh/${encodedHost}${encodedZedPath}`;
131 + }
132 + const encodedPath = rootedPath.split("/").map(encodeURIComponent).join("/");
133 + return `${scheme}://vscode-remote/ssh-remote+${encodedHost}${encodedPath}`;
134 };
135
136 /**