fix(cli): allow non-GitHub SCP-styled URLs for extension installation (#13800)

Co-authored-by: Maksym Kursin <maksym.kursin@dkatalis.com>
This commit is contained in:
Maksym
2025-11-26 00:57:53 +08:00
committed by GitHub
parent 2b41263aa7
commit f2c52f777c
2 changed files with 15 additions and 5 deletions

View File

@@ -84,9 +84,15 @@ export interface GithubRepoInfo {
}
export function tryParseGithubUrl(source: string): GithubRepoInfo | null {
// First step in normalizing a github ssh URI to the https form.
if (source.startsWith('git@github.com:')) {
source = source.replace('git@github.com:', '');
// Handle SCP-style SSH URLs.
if (source.startsWith('git@')) {
if (source.startsWith('git@github.com:')) {
// It's a GitHub SSH URL, so normalize it for the URL parser.
source = source.replace('git@github.com:', '');
} else {
// It's another provider's SSH URL (e.g., gitlab), so not a GitHub repo.
return null;
}
}
// Default to a github repo path, so `source` can be just an org/repo
const parsedUrl = URL.parse(source, 'https://github.com');