mirror of
https://github.com/openai/codex.git
synced 2026-09-09 15:58:47 +00:00
Fix Windows marketplace local source parsing
This commit is contained in:
@@ -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<PathBuf, MarketplaceAddError> {
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user