diff --git a/codex-rs/core/src/plugins/marketplace_add.rs b/codex-rs/core/src/plugins/marketplace_add.rs index 49c1c2e565..b8d1b34d41 100644 --- a/codex-rs/core/src/plugins/marketplace_add.rs +++ b/codex-rs/core/src/plugins/marketplace_add.rs @@ -275,9 +275,15 @@ mod tests { ); let config = fs::read_to_string(codex_home.path().join(codex_config::CONFIG_TOML_FILE))?; - assert!(config.contains("[marketplaces.debug]")); - assert!(config.contains("source_type = \"local\"")); - assert!(config.contains(&format!("source = \"{expected_source}\""))); + let config: toml::Value = toml::from_str(&config)?; + assert_eq!( + config["marketplaces"]["debug"]["source_type"].as_str(), + Some("local") + ); + assert_eq!( + config["marketplaces"]["debug"]["source"].as_str(), + Some(expected_source.as_str()) + ); Ok(()) } diff --git a/codex-rs/core/src/plugins/marketplace_add/source.rs b/codex-rs/core/src/plugins/marketplace_add/source.rs index 19fec57ade..cb7201c305 100644 --- a/codex-rs/core/src/plugins/marketplace_add/source.rs +++ b/codex-rs/core/src/plugins/marketplace_add/source.rs @@ -124,12 +124,14 @@ fn normalize_git_url(url: &str) -> String { } fn looks_like_local_path(source: &str) -> bool { + let path = Path::new(source); source.starts_with("./") || source.starts_with("../") || source.starts_with('/') || source.starts_with("~/") || source == "." || source == ".." + || path.is_absolute() } fn resolve_local_source_path(source: &str) -> Result { @@ -310,6 +312,20 @@ mod tests { assert!(path.is_absolute()); } + #[cfg(windows)] + #[test] + fn windows_absolute_path_source_parses() { + let source = + parse_marketplace_source(r"C:\temp\marketplace", /*explicit_ref*/ None).unwrap(); + + assert_eq!( + source, + MarketplaceSource::Local { + path: PathBuf::from(r"C:\temp\marketplace"), + } + ); + } + #[test] fn local_file_source_is_rejected() { let tempdir = TempDir::new().unwrap();