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

bug: unstrip_protocol incorrectly returns original path #979

Closed
jonburdo opened this issue Jun 10, 2022 · 0 comments · Fixed by #980
Closed

bug: unstrip_protocol incorrectly returns original path #979

jonburdo opened this issue Jun 10, 2022 · 0 comments · Fixed by #980
Labels
bug Something isn't working

Comments

@jonburdo
Copy link
Contributor

In version 2022.5.0, AbstractFileSystem.unstrip_protocol fails to preprend protocol:// to the path if the path happens to start with the characters of one of the class's protocols. For example:

from fsspec.spec import AbstractFileSystem

AbstractFileSystem().unstrip_protocol('abstract-file')
# 'abstract-file'

from s3fs import S3FileSystem

S3FileSystem().unstrip_protocol('s3-file')
# 's3-file'

S3FileSystem().unstrip_protocol('s3a-file')
# 's3a-file'

It works correctly any time the beginning of the path does not match the protocol:

AbstractFileSystem().unstrip_protocol('aabstract-file')
# 'abstract://aabstract-file'

S3FileSystem().unstrip_protocol('ss3-file')
# 's3://ss3-file'

Instead of returning the original path any time it starts with one of the protocols, the function should instead check for protocol + "://".

@efiop efiop added the bug Something isn't working label Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants