From a3dcf7fa8c14b809174edd725ef5d46557803521 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 5 Aug 2020 01:14:19 +0200 Subject: OwnerRepo: Remove ".git" suffix from HTTPS URLs I hadn't tested with HTTPS remote URLs, so assumed the code I copied from `github_suggestion::url` would work. It worked for suggestion comment URLs, but it doesn't work for remote URLs because the latter end in ".git". Remove this suffix to fix the bug. --- src/owner_repo.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/owner_repo.rs b/src/owner_repo.rs index ea5a510..273ef6f 100644 --- a/src/owner_repo.rs +++ b/src/owner_repo.rs @@ -76,9 +76,13 @@ impl FromStr for OwnerRepo { return Err(OwnerRepoError::NoOwnerRepo); } + let repo = path[1] + .strip_suffix(".git") + .unwrap_or(path[1]); + Ok(OwnerRepo { owner: path[0].to_owned(), - repo: path[1].to_owned(), + repo: repo.to_owned(), }) } } -- cgit v1.2.3