From 5b56249d129a5abd2413cb2295e12edc1ff66931 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 17 May 2024 10:12:05 +0200 Subject: [PATCH] Refactor gitCommitLink method in Application model --- app/Models/Application.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Models/Application.php b/app/Models/Application.php index 63ae132b1..dec13d276 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -192,10 +192,16 @@ class Application extends BaseModel public function gitCommitLink($link): string { if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) { + if (str($this->source->html_url)->contains('bitbucket')) { + return "{$this->source->html_url}/{$this->git_repository}/commits/{$link}"; + } return "{$this->source->html_url}/{$this->git_repository}/commit/{$link}"; } if (strpos($this->git_repository, 'git@') === 0) { $git_repository = str_replace(['git@', ':', '.git'], ['', '/', ''], $this->git_repository); + if (str($this->source->html_url)->contains('bitbucket')) { + return "https://{$git_repository}/commits/{$link}"; + } return "https://{$git_repository}/commit/{$link}"; } return $this->git_repository; @@ -993,7 +999,8 @@ class Application extends BaseModel getFilesystemVolumesFromServer($this, $isInit); } - public function parseHealthcheckFromDockerfile($dockerfile, bool $isInit = false) { + public function parseHealthcheckFromDockerfile($dockerfile, bool $isInit = false) + { if (str($dockerfile)->contains('HEALTHCHECK') && ($this->isHealthcheckDisabled() || $isInit)) { $healthcheckCommand = null; $lines = $dockerfile->toArray();