fix: make sure urls are http(s) and remove username

This commit is contained in:
Cyborus 2024-09-05 14:31:02 -04:00
parent 74d3748fa8
commit 5abfa90caf
No known key found for this signature in database

View file

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