File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -46,10 +46,10 @@ export function normalizeRepoUrl(url: string): string {
4646 . replace ( "ssh://git@github.com:" , "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 } ` ;
Original file line number Diff line number Diff 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://git@gitlab.com/owner/repo.git" ) ) . toBe (
152+ "ssh://git@gitlab.com/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" ,
You can’t perform that action at this time.
0 commit comments