Merge pull request #2183 from Lxcasx/main
Correct repository links in source view for git SSH URLs
This commit is contained in:
commit
a3c519a061
@ -146,9 +146,13 @@ public function gitBranchLocation(): Attribute
|
|||||||
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
|
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
|
||||||
return "{$this->source->html_url}/{$this->git_repository}/tree/{$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);
|
||||||
|
return "https://{$git_repository}/tree/{$this->git_branch}";
|
||||||
|
}
|
||||||
return $this->git_repository;
|
return $this->git_repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +163,11 @@ public function gitWebhook(): Attribute
|
|||||||
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
|
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
|
||||||
return "{$this->source->html_url}/{$this->git_repository}/settings/hooks";
|
return "{$this->source->html_url}/{$this->git_repository}/settings/hooks";
|
||||||
}
|
}
|
||||||
|
// Convert the SSH URL to HTTPS URL
|
||||||
|
if (strpos($this->git_repository, 'git@') === 0) {
|
||||||
|
$git_repository = str_replace(['git@', ':', '.git'], ['', '/', ''], $this->git_repository);
|
||||||
|
return "https://{$git_repository}/settings/hooks";
|
||||||
|
}
|
||||||
return $this->git_repository;
|
return $this->git_repository;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -171,6 +180,11 @@ public function gitCommits(): Attribute
|
|||||||
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
|
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
|
||||||
return "{$this->source->html_url}/{$this->git_repository}/commits/{$this->git_branch}";
|
return "{$this->source->html_url}/{$this->git_repository}/commits/{$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);
|
||||||
|
return "https://{$git_repository}/commits/{$this->git_branch}";
|
||||||
|
}
|
||||||
return $this->git_repository;
|
return $this->git_repository;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user