fix: bitbucket commits link

This commit is contained in:
Andras Bacsai 2024-05-23 14:28:03 +02:00
parent 853325d9fd
commit b47925a319

View File

@ -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