Skip to content

Commit f443ecd

Browse files
committed
chore: improve
1 parent 3624c79 commit f443ecd

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

shared/utils/git-providers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,16 @@ const providers: ProviderConfig[] = [
293293
* Handles: git+https://, git://, git@host:path, ssh://git@host/path
294294
*/
295295
export function normalizeGitUrl(input: string): string | null {
296-
const normalized = input
296+
let url = input
297297
.trim()
298298
.replace(/^git\+/, '')
299299
.replace(/\.git$/, '')
300300
.replace(/(^|\/)[^/]+?@/, '$1') // remove "user@" from "ssh://user@host.com:..."
301301
.replace(/(\.[^./]+?):/, '$1/') // change ".com:" to ".com/" from "ssh://user@host.com:..."
302302
.replace(/^git:\/\//, 'https://')
303303
.replace(/^ssh:\/\//, 'https://')
304-
return normalized || null
304+
url = url.includes('://') ? url : `https://${url}`
305+
return url || null
305306
}
306307

307308
export function parseRepoUrl(input: string): RepoRef | null {

0 commit comments

Comments
 (0)