fix(git): accept ssh:// repository URLs with custom ports

The repository URL rule rejected ssh://user@host:port/path, so deploy-key
resources on servers with a custom SSH port needed a manual URL edit after
creation. Accept ssh:// URLs and keep them unchanged for deploy keys so the
port reaches the clone. Rename scpStyleGitUrlToHttps to sshGitUrlToHttps and
let it convert ssh:// URLs too, so public flows, repository links and GitHub
App repository slugs handle them.

Closes #12161

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-10-15 22:30:26 +02:00
co-authored by Claude Opus 5.5
parent c82cac626f
commit 7466da12a2
12 changed files with 105 additions and 24 deletions
+7 -1
View File
@@ -47,7 +47,7 @@ it('does not generate commit links from incomplete repository URLs', function (s
'git protocol' => 'git://git.example.com/coollabsio/coolify.git',
]);
it('converts scp-style remotes with generic usernames into https repository links', function (string $repository, string $expectedBranch, string $expectedCommits, string $expectedWebhook) {
it('converts ssh remotes with generic usernames into https repository links', function (string $repository, string $expectedBranch, string $expectedCommits, string $expectedWebhook) {
$application = new Application;
$application->setRelation('source', null);
$application->git_repository = $repository;
@@ -76,4 +76,10 @@ it('converts scp-style remotes with generic usernames into https repository link
'https://git.example.com/organization/repository/commits/main',
'https://git.example.com/organization/repository/settings/hooks',
],
'ssh scheme with port' => [
'ssh://git@gitea.example.com:2222/organization/repository.git',
'https://gitea.example.com/organization/repository/tree/main/',
'https://gitea.example.com/organization/repository/commits/main',
'https://gitea.example.com/organization/repository/settings/hooks',
],
]);