mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 03:59:31 +01:00
fix: make sure urls are http(s) and remove username
This commit is contained in:
parent
74d3748fa8
commit
5abfa90caf
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)
|
(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) {
|
let info = match (url, name) {
|
||||||
(Some(url), name) => RepoInfo { url, name },
|
(Some(url), name) => RepoInfo { url, name },
|
||||||
|
|
Loading…
Reference in a new issue