From 174a766ae613493a3644e8c9705ec5a5c5df3a2f Mon Sep 17 00:00:00 2001 From: Claude Code Date: Sun, 2 Nov 2025 20:07:33 +0000 Subject: [PATCH] Fix null handling for custom_port to prevent SSH connection failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- bootstrap/helpers/shared.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 8665cf611..a41482b02 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -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; }