From 2dbba366b72e4204d9473cadbe0bf20a664b5b89 Mon Sep 17 00:00:00 2001 From: Lorenzo Migliorero Date: Fri, 19 Jul 2024 13:41:01 +0200 Subject: [PATCH] fix: bitbucket repository url --- app/Models/Application.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Models/Application.php b/app/Models/Application.php index 81fdb5a1e..e628ba48c 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -275,12 +275,20 @@ public function gitBranchLocation(): Attribute return Attribute::make( get: function () { if (! is_null($this->source?->html_url) && ! is_null($this->git_repository) && ! is_null($this->git_branch)) { + if (str($this->git_repository)->contains('bitbucket')) { + return "{$this->source->html_url}/{$this->git_repository}/src/{$this->git_branch}"; + } + return "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_branch}"; } // Convert the SSH URL to HTTPS URL if (strpos($this->git_repository, 'git@') === 0) { $git_repository = str_replace(['git@', ':', '.git'], ['', '/', ''], $this->git_repository); + if (str($this->git_repository)->contains('bitbucket')) { + return "https://{$git_repository}/src/{$this->git_branch}"; + } + return "https://{$git_repository}/tree/{$this->git_branch}"; }