mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
refactor: rewrite commit web link
* add support for Bitbucket
This commit is contained in:
parent
48de509c63
commit
bf6ac4d20d
4 changed files with 13 additions and 9 deletions
|
@ -58,10 +58,12 @@ namespace SourceGit.Models
|
|||
|
||||
if (URL.StartsWith("http", StringComparison.Ordinal))
|
||||
{
|
||||
if (URL.EndsWith(".git"))
|
||||
url = URL.Substring(0, URL.Length - 4);
|
||||
// Try to remove the user before host and `.git` extension.
|
||||
var uri = new Uri(URL.EndsWith(".git", StringComparison.Ordinal) ? URL.Substring(0, URL.Length - 4) : URL);
|
||||
if (uri.Port != 80 && uri.Port != 443)
|
||||
url = $"{uri.Scheme}://{uri.Host}:{uri.Port}{uri.LocalPath}";
|
||||
else
|
||||
url = URL;
|
||||
url = $"{uri.Scheme}://{uri.Host}{uri.LocalPath}";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue