From 58e5615bf6b0c4f8c05b96b2f4b50cdd044d2cdb Mon Sep 17 00:00:00 2001 From: Lu Yang Date: Wed, 17 Apr 2024 11:44:52 +0100 Subject: [PATCH] strip ending "/" for repo url --- lapdev-conductor/src/server.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lapdev-conductor/src/server.rs b/lapdev-conductor/src/server.rs index 44d2746..15c0b42 100644 --- a/lapdev-conductor/src/server.rs +++ b/lapdev-conductor/src/server.rs @@ -526,14 +526,17 @@ impl Conductor { fn format_repo_url(&self, repo: &str) -> String { let repo = repo.trim(); - if !repo.starts_with("http://") + let repo = if !repo.starts_with("http://") && !repo.starts_with("https://") && !repo.starts_with("ssh://") { format!("https://{repo}") } else { repo.to_string() - } + }; + repo.strip_suffix('/') + .map(|r| r.to_string()) + .unwrap_or(repo) } async fn get_raw_repo_details(