File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff 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 } ` ;
Original file line number Diff line number Diff 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" , ( ) => {
You can’t perform that action at this time.
0 commit comments