Skip to content

Commit 0e9dc13

Browse files
fix: repo edge case
1 parent 58a9026 commit 0e9dc13

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

core/util/repoUrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function normalizeRepoUrl(url: string): string {
4949
// Convert shorthand owner/repo to full URL
5050
if (
5151
normalized.includes("/") &&
52-
!normalized.includes("://") &&
52+
!/^[a-z]+:\/\//i.test(normalized) &&
5353
!normalized.startsWith("git@")
5454
) {
5555
normalized = `https://github.com/${normalized}`;

core/util/repoUrl.vitest.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ describe("normalizeRepoUrl", () => {
164164
"https://github.com/owner/repo-with-dashes-123",
165165
);
166166
});
167+
168+
it("should normalize shorthand with query parameters containing ://", () => {
169+
// Regression test: :// in query params should not prevent normalization
170+
expect(normalizeRepoUrl("owner/repo?redirect=https://example.com")).toBe(
171+
"https://github.com/owner/repo?redirect=https://example.com",
172+
);
173+
});
174+
175+
it("should normalize shorthand with fragment containing ://", () => {
176+
expect(normalizeRepoUrl("owner/repo#section=https://example.com")).toBe(
177+
"https://github.com/owner/repo#section=https://example.com",
178+
);
179+
});
167180
});
168181

169182
describe("real-world examples", () => {

0 commit comments

Comments
 (0)