fix: return null for invalid repository URLs

This commit is contained in:
Andras Bacsai
2026-09-04 15:44:18 +02:00
parent 053b030c42
commit 2ebbc5113e
2 changed files with 16 additions and 1 deletions
@@ -26,3 +26,14 @@ it('generates commit links for direct repository remotes', function (string $rep
'https://bitbucket.org/coollabsio/coolify/commits/1234567890abcdef',
],
]);
it('does not generate commit links from incomplete repository URLs', function (string $repository) {
$application = new Application;
$application->setRelation('source', null);
$application->git_repository = $repository;
expect($application->gitCommitLink('1234567890abcdef'))->toBeNull();
})->with([
'missing host' => 'https://',
'missing scheme' => 'github.com/coollabsio/coolify',
]);