From 36b80dd9be777e70e811db66bc1a0894685a06b8 Mon Sep 17 00:00:00 2001 From: David Wiesen Date: Sat, 25 Apr 2026 20:44:12 -0700 Subject: [PATCH] Clarify mapped-drive cwd normalization --- codex-rs/windows-sandbox-rs/src/path_normalization.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codex-rs/windows-sandbox-rs/src/path_normalization.rs b/codex-rs/windows-sandbox-rs/src/path_normalization.rs index 4ffc33d1ce..bac7fb33ec 100644 --- a/codex-rs/windows-sandbox-rs/src/path_normalization.rs +++ b/codex-rs/windows-sandbox-rs/src/path_normalization.rs @@ -17,6 +17,8 @@ pub fn canonical_path_key(path: &Path) -> String { .to_ascii_lowercase() } +/// Resolve mapped drive working directories into their UNC targets before launching +/// sandboxed processes under an alternate logon session. pub fn normalize_command_cwd(path: &Path) -> PathBuf { let simplified = dunce::simplified(path).to_path_buf(); normalize_mapped_drive_path_with(&simplified, mapped_drive_remote_root).unwrap_or(simplified) @@ -48,7 +50,8 @@ fn mapped_drive_remote_root(drive: &str) -> Option { loop { let mut buf = vec![0u16; len as usize]; - let status = unsafe { WNetGetConnectionW(drive_wide.as_ptr(), buf.as_mut_ptr(), &mut len) }; + let status = + unsafe { WNetGetConnectionW(drive_wide.as_ptr(), buf.as_mut_ptr(), &mut len) }; match status { NO_ERROR => { let end = buf.iter().position(|ch| *ch == 0).unwrap_or(buf.len());