Remove shell-words and use shlex

This commit is contained in:
Daniel Edrisian
2025-08-21 15:09:23 -07:00
parent 884d2755c1
commit 3aab62829f
3 changed files with 3 additions and 12 deletions

7
codex-rs/Cargo.lock generated
View File

@@ -976,7 +976,6 @@ dependencies = [
"reqwest",
"serde",
"serde_json",
"shell-words",
"shlex",
"strum 0.27.2",
"strum_macros 0.27.2",
@@ -4399,12 +4398,6 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "shell-words"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
[[package]]
name = "shlex"
version = "1.3.0"

View File

@@ -60,7 +60,6 @@ regex-lite = "0.1"
reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] }
shell-words = "1.1"
shlex = "1.3.0"
strum = "0.27.2"
strum_macros = "0.27.2"

View File

@@ -9,10 +9,9 @@ pub fn normalize_pasted_path(pasted: &str) -> Option<PathBuf> {
}
// shell-escaped single path → unescaped
if let Ok(mut parts) = shell_words::split(pasted) {
if parts.len() == 1 {
return Some(PathBuf::from(parts.remove(0)));
}
let parts: Vec<String> = shlex::Shlex::new(pasted).collect();
if parts.len() == 1 {
return parts.into_iter().next().map(PathBuf::from);
}
// simple quoted path fallback