mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-03 05:19:37 +00:00
fix(git): preserve ssh scheme URLs with custom ports (#9425)
This commit is contained in:
3 files changed
+78
-6
No files matched your search
@@ -3660,13 +3660,21 @@ function convertGitUrl(string $gitRepository, string $deploymentType, GithubApp|
|
||||
}
|
||||
}
|
||||
|
||||
preg_match('/(?<=:)\d+(?=\/)/', $gitRepository, $matches);
|
||||
$normalizedRepository = $repository;
|
||||
|
||||
if (count($matches) === 1) {
|
||||
$providerInfo['port'] = $matches[0];
|
||||
$gitHost = str($gitRepository)->before(':');
|
||||
$gitRepo = str($gitRepository)->after('/');
|
||||
$repository = "$gitHost:$gitRepo";
|
||||
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>.+)$/', $normalizedRepository, $matches);
|
||||
|
||||
if (! empty($matches['port'])) {
|
||||
$providerInfo['port'] = $matches['port'];
|
||||
$repository = "{$matches['host']}:{$matches['path']}";
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
Reference in new issue
Block a user