summaryrefslogtreecommitdiffstats
path: root/src/repo.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/repo.rs')
-rw-r--r--src/repo.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/repo.rs b/src/repo.rs
index c55c51b..7c76b61 100644
--- a/src/repo.rs
+++ b/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 },