mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
Fix null handling for custom_port to prevent SSH connection failures
Previously, when custom_port was null (the common case), the code would set the port to null, breaking SSH connections. This fix adds proper null checks and defaults to port 22 when custom_port is not set. Changes: - Add null check before comparing custom_port to prevent null assignment - Cast custom_port to int for type safety - Default to port 22 when custom_port is null in fallback URL construction Fixes the issue reported by CodeRabbit in PR review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b6650a099d
commit
174a766ae6
1 changed files with 3 additions and 3 deletions
|
|
@ -3036,8 +3036,8 @@ function convertGitUrl(string $gitRepository, string $deploymentType, GithubApp|
|
|||
switch ($source->getMorphClass()) {
|
||||
case \App\Models\GithubApp::class:
|
||||
case \App\Models\GitlabApp::class:
|
||||
if ($source->custom_port !== 22) {
|
||||
$providerInfo['port'] = $source->custom_port;
|
||||
if ($source->custom_port !== null && (int) $source->custom_port !== 22) {
|
||||
$providerInfo['port'] = (int) $source->custom_port;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -3050,7 +3050,7 @@ function convertGitUrl(string $gitRepository, string $deploymentType, GithubApp|
|
|||
case \App\Models\GithubApp::class:
|
||||
case \App\Models\GitlabApp::class:
|
||||
$providerInfo['host'] = Url::fromString($source->html_url)->getHost();
|
||||
$providerInfo['port'] = $source->custom_port;
|
||||
$providerInfo['port'] = $source->custom_port ?? 22;
|
||||
$providerInfo['user'] = $source->custom_user;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue