Skip to content

AzureBlobFileSystem._strip_protocol strips leading slashes when container is missing #484

@ap--

Description

@ap--

Hello,

I have a question regarding the behavior of _strip_protocol. When comparing s3fs, gcsfs and adlfs I observed that for urlpaths that are missing a container (netloc), leading slashes are lstripped. It seems that this was introduced in #332.

>>> import fsspec

# identical behavior for urlpaths with netloc
>>> fsspec.get_filesystem_class("s3")._strip_protocol("s3://bucket/a/b/c")
'bucket/a/b/c'
>>> fsspec.get_filesystem_class("gs")._strip_protocol("gs://bucket/a/b/c")
'bucket/a/b/c'
>>> fsspec.get_filesystem_class("az")._strip_protocol("az://bucket/a/b/c")
'bucket/a/b/c'

# different behavior for incorrect urlpaths
>>> fsspec.get_filesystem_class("s3")._strip_protocol("s3:///a/b/c")
'/a/b/c'
>>> fsspec.get_filesystem_class("gs")._strip_protocol("gs:///a/b/c")
'/a/b/c'
>>> fsspec.get_filesystem_class("az")._strip_protocol("az:///a/b/c")
'a/b/c'  # <- adlfs strips the leading slash

Currently az:///a/b/c and az://a/b/c are considered equivalent. Is this intentional? If not I can work on a PR.

Cheers,
Andreas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions