mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-09-20 08:05:04 +02:00
Merge pull request 'clean up urls better' (#126) from url-cleanup into main
Reviewed-on: https://codeberg.org/Cyborus/forgejo-cli/pulls/126
This commit is contained in:
commit
b7aa1e95b6
1 changed files with 9 additions and 1 deletions
10
src/repo.rs
10
src/repo.rs
|
@ -166,7 +166,15 @@ impl RepoInfo {
|
|||
(host_url, None)
|
||||
};
|
||||
|
||||
let url = url.or_else(fallback_host);
|
||||
let url = url.or_else(fallback_host).map(|url| {
|
||||
let mut url = match url.scheme() {
|
||||
"http" | "https" => url,
|
||||
_ => url::Url::parse(&format!("https{}", &url[url::Position::AfterScheme..]))
|
||||
.expect("should always be valid"),
|
||||
};
|
||||
url.set_username("").expect("shouldn't fail");
|
||||
url
|
||||
});
|
||||
|
||||
let info = match (url, name) {
|
||||
(Some(url), name) => RepoInfo { url, name },
|
||||
|
|
Loading…
Reference in a new issue