Skip to content

Incorrect prefix in ObjectStoreScheme::parse for Azure HTTP urls #398

Open
@kylebarron

Description

@kylebarron

Describe the bug

In Azure, there is a URL format like:

https://overturemapswestus2.blob.core.windows.net/release/path/to/file.txt

this is

https://{account_name}.blob.core.windows.net/{container_name}/{file_path}

However the container name is included in the file path in ObjectStoreScheme::parse. I'd argue this is a bug, but it's at least very confusing.

To Reproduce

#[test]
fn test_prefix() {
    let url = "https://overturemapswestus2.blob.core.windows.net/release/path/to/file.txt";
    let (scheme, path) = ObjectStoreScheme::parse(&url.parse().unwrap()).unwrap();
    assert_eq!(scheme, ObjectStoreScheme::MicrosoftAzure);
    assert_eq!(path, Path::from("path/to/file.txt"));
}

The release/ should be taken off the resulting Path in my opinion.

Expected behavior

Expected the container name to be taken off the path before returning. I.e. I expect the path to be the path inside the container.

Additional context

developmentseed/obstore#477

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