@devries-cameron20 / t3code Mirror · read-only / commits / cef95b6db9
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 21, 12:15 UTC

fix(shared): decode URI paths in ghq clone folders (#37004)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Simone committed Nov 15, 2026 at 02:58 UTC cef95b6db91d75293489a5a0b42a59758d97a868
2 files changed +22 -2
packages/shared/src/cloneUrl.test.ts
+15 -1
@@ -175,7 +175,7 @@ describe("cloneUrlForProtocol", () => {
175 });
176
177 describe("cloneUrlRepositoryPath", () => {
178 - it("rejects Windows device names and trailing dots or spaces in every folder", () => {
178 + it("derives portable clone folders from URI and SCP paths", () => {
179 for (const segment of [
180 "CON",
181 "nul.txt",
@@ -197,5 +197,19 @@ describe("cloneUrlRepositoryPath", () => {
197 "gitlab.com/group/sub/repo",
198 );
199 expect(cloneUrlRepositoryPath("C:/repos/project.git")).toBeNull();
200 + for (const prefix of ["https://host.example/", "ssh://git@host.example/"]) {
201 + expect(cloneUrlRepositoryPath(`${prefix}Research%20Tools/r%C3%A9sum%C3%A9.git`)).toBe(
202 + "host.example/Research Tools/résumé",
203 + );
204 + expect(cloneUrlRepositoryPath(`${prefix}team/repo%2520name.git`)).toBe(
205 + "host.example/team/repo%20name",
206 + );
207 + expect(cloneUrlRepositoryPath(`${prefix}team/%2e%2e/repo.git`)).toBeNull();
208 + expect(cloneUrlRepositoryPath(`${prefix}team/repo%20.git`)).toBeNull();
209 + expect(cloneUrlRepositoryPath(`${prefix}team/bad%FF.git`)).toBeNull();
210 + }
211 + expect(cloneUrlRepositoryPath("git@host.example:team/repo%20name.git")).toBe(
212 + "host.example/team/repo%20name",
213 + );
214 });
215 });
packages/shared/src/cloneUrl.ts
+7 -1
@@ -80,7 +80,13 @@ export function cloneUrlRepositoryPath(url: string): string | null {
80 if (isWindowsDrivePath(url.trim())) return null;
81 const parsed = parseCloneUrl(url);
82 if (!parsed) return null;
83 - const segments = [parsed.host, ...parsed.path.split(/[?#]/)[0]!.split("/").filter(Boolean)];
83 + let repositoryPath = parsed.path.split(/[?#]/)[0]!;
84 + try {
85 + if (!parsed.scp) repositoryPath = decodeURIComponent(repositoryPath);
86 + } catch {
87 + return null;
88 + }
89 + const segments = [parsed.host, ...repositoryPath.split("/").filter(Boolean)];
90 const last = segments.at(-1)!;
91 if (last.endsWith(".git")) segments[segments.length - 1] = last.slice(0, -".git".length);
92 if (