diff --git a/codex-rs/utils/path-uri/src/api_path_string_tests.rs b/codex-rs/utils/path-uri/src/api_path_string_tests.rs index 52a065a6b7..a4916d4765 100644 --- a/codex-rs/utils/path-uri/src/api_path_string_tests.rs +++ b/codex-rs/utils/path-uri/src/api_path_string_tests.rs @@ -571,3 +571,23 @@ fn native_resolution_rejects_reserved_windows_device_names() { ); } } + +#[test] +fn native_resolution_rejects_drive_relative_and_incomplete_unc_paths() { + let base = PathUri::parse("file:///C:/workspace").expect("Windows URI"); + + for (path, rejected_path) in [ + (r"C:relative", r"C:\workspace\C:relative"), + (r"\\server", r"\\server"), + ("\\\\server\\", "\\\\server\\"), + ] { + assert_eq!( + base.resolve_native(path, PathConvention::Windows), + Err(ApiPathStringError::InvalidNativePath { + path: rejected_path.to_string(), + convention: PathConvention::Windows, + }), + "resolving {path:?}" + ); + } +}