fix(git): preserve ssh scheme URLs with custom ports

This commit is contained in:
Iisyourdad committed 2026-04-04 14:49:34 -05:00
1 parent ffb5045c6a
commit f877985e56
3 files changed
+40 -6

No files matched your search

+12 -6
View File
@@ -3660,13 +3660,19 @@ function convertGitUrl(string $gitRepository, string $deploymentType, GithubApp|
}
}
preg_match('/(?<=:)\d+(?=\/)/', $gitRepository, $matches);
if (str($gitRepository)->contains('://')) {
$parsedRepository = parse_url($gitRepository);
if (count($matches) === 1) {
$providerInfo['port'] = $matches[0];
$gitHost = str($gitRepository)->before(':');
$gitRepo = str($gitRepository)->after('/');
$repository = "$gitHost:$gitRepo";
if ($parsedRepository !== false && array_key_exists('port', $parsedRepository)) {
$providerInfo['port'] = (string) $parsedRepository['port'];
}
} else {
preg_match('/^(?<host>[^:]+):(?<port>\d+)\/(?<path>.+)$/', $gitRepository, $matches);
if (! empty($matches['port'])) {
$providerInfo['port'] = $matches['port'];
$repository = "{$matches['host']}:{$matches['path']}";
}
}
return [