mirror of
https://github.com/openai/codex.git
synced 2026-11-14 06:48:26 +00:00
Normalize Windows namespace paths in path URIs (#35851)
## What changed - Convert Windows device-namespace drive paths such as `\\?\D:\reports` and `\\.\D:\reports` to canonical drive-based `file:` URIs. - Convert device-namespace UNC paths to canonical hosted `file:` URIs. - Preserve unsupported or ambiguous namespace paths as opaque path URIs instead of interpreting them as filesystem paths. ## Testing Add coverage for namespace path conversion and joining, including malformed UNC paths, reserved device names, and volume identifiers. GitOrigin-RevId: 234f69bc2787e5d318bc0320b94e7392abfb5602
This commit is contained in:
1 parent
101d6b8cb2
commit
8707a35113
3 files changed
+88
-1
No files matched your search
@@ -150,7 +150,8 @@ fn normalize_path_for_platform(path: &Path) -> Cow<'_, Path> {
|
||||
Cow::Borrowed(path)
|
||||
}
|
||||
|
||||
fn normalize_windows_device_path(path: &str) -> Option<String> {
|
||||
/// Normalizes Windows drive and UNC namespace aliases on any host.
|
||||
pub fn normalize_windows_device_path(path: &str) -> Option<String> {
|
||||
if let Some(unc) = path.strip_prefix(r"\\?\UNC\") {
|
||||
return Some(format!(r"\\{unc}"));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user