Fix repository URL handling in PublicGitRepository.php

This commit is contained in:
Andras Bacsai
2024-04-30 11:11:06 +02:00
parent 57d67bc4a8
commit 4af766162e

View File

@@ -97,10 +97,14 @@ class PublicGitRepository extends Component
if ( if (
(str($this->repository_url)->startsWith('https://') || (str($this->repository_url)->startsWith('https://') ||
str($this->repository_url)->startsWith('http://')) && str($this->repository_url)->startsWith('http://')) &&
!str($this->repository_url)->endsWith('.git') !str($this->repository_url)->endsWith('.git') &&
!str($this->repository_url)->contains('github.com')
) { ) {
$this->repository_url = $this->repository_url . '.git'; $this->repository_url = $this->repository_url . '.git';
} }
if (str($this->repository_url)->contains('github.com')) {
$this->repository_url = str($this->repository_url)->before('.git')->value();
}
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }