GeezerVison is showing github.com — fix(shared): escape literal SSH path punctuation when switching to HT… · patroza/t3code@c6df984
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/shared/src/cloneUrl.test.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -149,6 +149,9 @@ describe("cloneUrlForProtocol", () => { |
149 | 149 | expect(cloneUrlForProtocol(scp, "https")).toBe(https); |
150 | 150 | expect(cloneUrlForProtocol(`ssh://[email protected]/team/${encoded}`, "https")).toBe(https); |
151 | 151 | } |
| 152 | + expect(cloneUrlForProtocol("ssh://[email protected]/team/repo%20name#1?.git", "https")).toBe( |
| 153 | + "https://host.example/team/repo%20name%231%3F.git", |
| 154 | + ); |
152 | 155 | }); |
153 | 156 |
|
154 | 157 | it("keeps the URL as is for its own protocol and drops HTTPS credentials on switch", () => { |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/shared/src/cloneUrl.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -80,7 +80,7 @@ export function cloneUrlForProtocol(url: string, protocol: CloneProtocol): strin |
80 | 80 | if (protocol === "ssh") return `git@${host}:${decodeURIComponent(parsed.path)}`; |
81 | 81 | const path = parsed.scp |
82 | 82 | ? parsed.path.split("/").map(encodeURIComponent).join("/") |
83 | | - : parsed.path; |
| 83 | + : parsed.path.replaceAll("#", "%23").replaceAll("?", "%3F"); |
84 | 84 | return `https://${host}/${path}`; |
85 | 85 | } catch { |
86 | 86 | return null; |
|