diff --git a/codex-rs/core/src/plugins/marketplace_add/source.rs b/codex-rs/core/src/plugins/marketplace_add/source.rs index 53d52058aa..2a49d925df 100644 --- a/codex-rs/core/src/plugins/marketplace_add/source.rs +++ b/codex-rs/core/src/plugins/marketplace_add/source.rs @@ -130,6 +130,16 @@ fn looks_like_local_path(source: &str) -> bool { || source.starts_with("~/") || source == "." || source == ".." + || { + #[cfg(windows)] + { + source.starts_with(".\\") || source.starts_with("..\\") || source.starts_with('\\') + } + #[cfg(not(windows))] + { + false + } + } } fn resolve_local_source_path(source: &str) -> Result { @@ -310,6 +320,14 @@ mod tests { assert!(path.is_absolute()); } + #[cfg(windows)] + #[test] + fn windows_backslash_relative_path_looks_local() { + assert!(looks_like_local_path(r".\marketplace")); + assert!(looks_like_local_path(r"..\marketplace")); + assert!(looks_like_local_path(r"\marketplace")); + } + #[test] fn local_file_source_is_rejected() { let tempdir = TempDir::new().unwrap();