Fix empty string handling for custom_port to match defensive pattern

The null coalescing operator (??) only checks for null, not empty strings.
When custom_port is an empty string, it would pass through and cause SSH
connections to fail with an invalid port.

This commit updates line 3053 to match the same defensive pattern used at
lines 3039-3041, checking for null, empty strings, and casting to int for
consistent validation across both code paths.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Code 2025-11-02 20:17:21 +00:00
parent 174a766ae6
commit 8abbf284a5

View file

@ -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 ?? 22;
$providerInfo['port'] = ($source->custom_port !== null && $source->custom_port !== '' && (int) $source->custom_port !== 22) ? (int) $source->custom_port : 22;
$providerInfo['user'] = $source->custom_user;
break;
}