Skip to content

Commit 9c35910

Browse files
fix: normalization
1 parent 2ba3ee3 commit 9c35910

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

core/util/repoUrl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ export function normalizeRepoUrl(url: string): string {
4646
.replace("ssh://[email protected]:", "https://github.com/");
4747
}
4848

49-
// Convert shorthand owner/repo to full URL (check case-insensitively)
49+
// Convert shorthand owner/repo to full URL
5050
if (
5151
normalized.includes("/") &&
52-
!normalized.toLowerCase().startsWith("http") &&
52+
!normalized.includes("://") &&
5353
!normalized.startsWith("git@")
5454
) {
5555
normalized = `https://github.com/${normalized}`;

core/util/repoUrl.vitest.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ describe("normalizeRepoUrl", () => {
146146
);
147147
});
148148

149+
it("should not convert non-GitHub SSH URLs to GitHub", () => {
150+
// Regression test: SSH URLs with protocols should not be treated as shorthands
151+
expect(normalizeRepoUrl("ssh://[email protected]/owner/repo.git")).toBe(
152+
"ssh://[email protected]/owner/repo",
153+
);
154+
});
155+
149156
it("should handle URLs with port numbers", () => {
150157
expect(normalizeRepoUrl("https://github.com:443/owner/repo")).toBe(
151158
"https://github.com:443/owner/repo",

0 commit comments

Comments
 (0)