Fix repository URL handling in PublicGitRepository.php

This commit is contained in:
Andras Bacsai 2024-04-16 10:09:59 +02:00
parent a00b5aa136
commit b16109ca56

View File

@ -89,9 +89,11 @@ public function load_any_git()
public function load_branch()
{
try {
$this->validate([
'repository_url' => 'required|url'
]);
if (str($this->repository_url)->startsWith('git@')) {
$github_instance = str($this->repository_url)->after('git@')->before(':');
$repository = str($this->repository_url)->after(':')->before('.git');
$this->repository_url = 'https://' . str($github_instance) . '/' . $repository;
}
} catch (\Throwable $e) {
return handleError($e, $this);
}