From b47925a3197124e8b0cd23a9f2fd146d9480fee5 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 23 May 2024 14:28:03 +0200 Subject: [PATCH] fix: bitbucket commits link --- app/Models/Application.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Models/Application.php b/app/Models/Application.php index 0f3425dd6..e6fd3e33d 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -10,6 +10,7 @@ use Spatie\Activitylog\Models\Activity; use Illuminate\Support\Str; use RuntimeException; +use Spatie\Url\Url; use Symfony\Component\Yaml\Yaml; use Visus\Cuid2\Cuid2; @@ -213,6 +214,13 @@ public function gitCommitLink($link): string $git_repository = str_replace(['git@', ':', '.git'], ['', '/', ''], $this->git_repository); return "https://{$git_repository}/commit/{$link}"; } + if (str($this->git_repository)->contains('bitbucket')) { + $git_repository = str_replace('.git', '', $this->git_repository); + $url = Url::fromString($git_repository); + $url = $url->withUserInfo(''); + $url = $url->withPath($url->getPath() . '/commits/' . $link); + return $url->__toString(); + } return $this->git_repository; } public function dockerfileLocation(): Attribute