Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ap-- opened this issue Aug 30, 2024 · 0 comments

Comments

@ap--
Copy link
Contributor

ap-- commented Aug 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant