File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
packages/cli/src/config/extensions Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,16 @@ export function tryParseGithubUrl(source: string): GithubRepoInfo | null {
9595 }
9696 }
9797 // Default to a github repo path, so `source` can be just an org/repo
98- const parsedUrl = URL . parse ( source , 'https://github.com' ) ;
98+ let parsedUrl : URL ;
99+ try {
100+ // Use the standard URL constructor for backward compatibility.
101+ parsedUrl = new URL ( source , 'https://github.com' ) ;
102+ } catch ( e ) {
103+ // Throw a TypeError to maintain a consistent error contract for invalid URLs.
104+ // This avoids a breaking change for consumers who might expect a TypeError.
105+ throw new TypeError ( `Invalid repo URL: ${ source } ` , { cause : e } ) ;
106+ }
107+
99108 if ( ! parsedUrl ) {
100109 throw new Error ( `Invalid repo URL: ${ source } ` ) ;
101110 }
You can’t perform that action at this time.
0 commit comments