fix(git): harden ssh URL normalization

This commit is contained in:
Iisyourdad
2026-04-07 22:41:15 -05:00
parent f877985e56
commit d2ada90a47
2 changed files with 41 additions and 3 deletions
+5 -3
View File
@@ -3660,14 +3660,16 @@ function convertGitUrl(string $gitRepository, string $deploymentType, GithubApp|
}
}
if (str($gitRepository)->contains('://')) {
$parsedRepository = parse_url($gitRepository);
$normalizedRepository = $repository;
if (str($normalizedRepository)->contains('://')) {
$parsedRepository = parse_url($normalizedRepository);
if ($parsedRepository !== false && array_key_exists('port', $parsedRepository)) {
$providerInfo['port'] = (string) $parsedRepository['port'];
}
} else {
preg_match('/^(?<host>[^:]+):(?<port>\d+)\/(?<path>.+)$/', $gitRepository, $matches);
preg_match('/^(?<host>[^:]+):(?<port>\d+)\/(?<path>.+)$/', $normalizedRepository, $matches);
if (! empty($matches['port'])) {
$providerInfo['port'] = $matches['port'];