Skip to content

Difficulty working with Windows paths when using url > 2.5.4 #499

@westonpace

Description

@westonpace

Describe the bug
If I am on Windows, and using the 2.5.7 version of the url package, then I encounter errors due to a behavior change in the url package. I have filed an upstream issue (servo/rust-url#1077) but would like to open this issue in case there are recommendations for a different approach or the upstream crate suggests a different approach.

To Reproduce

Here is a test that reproduces the issue. It only relies on the tempfile and tokio crates.

#[tokio::test]
async fn test_obj_store() {
    use std::io::Write;

    let tmpdir = tempfile::tempdir().unwrap();
    let tmp_file = tmpdir.path().join("test.file");

    let mut rust_file = std::fs::File::create(tmp_file.clone()).unwrap();
    write!(rust_file, "test").unwrap();
    drop(rust_file);

    let tmp_path = tmp_file.to_str().unwrap();
    // File parses ok
    let obj_path = Path::parse(tmp_path).unwrap();

    // This fails if url is at version 2.5.7 and passes if url is at version 2.5.4
    LocalFileSystem::new().get_opts(&obj_path, GetOptions {
        head: true,
        ..Default::default()
    }).await.unwrap();
}

Expected behavior
The above test should pass

Additional context
This was encountered because datafusion version 50 forced an upgrade to 2.5.7 of the url package: https://github.com/apache/datafusion/blob/10343c18292fc3a9ca62b59c8bb530169fe79b82/Cargo.toml#L181

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions