From 674015acdfa29a69b4e6174db16b37bbc6ed62f4 Mon Sep 17 00:00:00 2001 From: xli-oai Date: Fri, 10 Apr 2026 12:55:09 -0700 Subject: [PATCH] Normalize marketplace GitHub URLs with trailing slash --- codex-rs/cli/src/marketplace_cmd.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/codex-rs/cli/src/marketplace_cmd.rs b/codex-rs/cli/src/marketplace_cmd.rs index e26f80638d..f5df805e4b 100644 --- a/codex-rs/cli/src/marketplace_cmd.rs +++ b/codex-rs/cli/src/marketplace_cmd.rs @@ -308,6 +308,7 @@ fn non_empty_ref(ref_name: &str) -> Option { } fn normalize_git_url(url: &str) -> String { + let url = url.trim_end_matches('/'); if url.starts_with("https://github.com/") && !url.ends_with(".git") { format!("{url}.git") } else { @@ -520,6 +521,21 @@ mod tests { ); } + #[test] + fn github_url_with_trailing_slash_normalizes_without_extra_path_segment() { + assert_eq!( + parse_marketplace_source( + "https://github.com/owner/repo/", + /* explicit_ref */ None + ) + .unwrap(), + MarketplaceSource::Git { + url: "https://github.com/owner/repo.git".to_string(), + ref_name: None, + } + ); + } + #[test] fn non_github_https_source_parses_as_git_url() { assert_eq!(