-
Notifications
You must be signed in to change notification settings - Fork 42
The prefix file:// results in ignoring the first path component. #108
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
Comments
thank you for opening an issue! I do have a pretty good idea where the error is occurring here, but I'd love to have some more information from you beforehand.
Basically Cheers, |
I initially tried "file://" expecting it to follow other url-like parameters. If the implementation interprets the first string as hostname it should make sure that the value is usable and throw an error otherwise. i.e. if hostname != 'localhost' and hostname != '' then it should imho raise an ArgumentError. |
moved to new issue #142 |
In my CPython PR I made it work the same on POSIX, and so: >>> pathlib.Path.from_uri('file://var/tmp')
PosixPath('//var/tmp') Note that paths with two leading slashes are allowed by POSIX:
|
Thanks for the clarification @barneygale! So does that mean how does that fit together with rfc8089? Are |
I've never come across file URIs that use The RFC also says:
... which works fine on Windows, but not on other systems :( |
Fixed in >>> import os
>>> os.getcwd()
'/home/user'
>>> import upath
>>> PATHS = ['/tmp/test', 'file:/tmp/test', 'file://tmp/test', 'file:///tmp/test']
>>> {p: upath.UPath(p) for p in PATHS}
{
'/tmp/buh': PosixUPath('/tmp/buh'),
'file:/tmp/buh': FilePath('file:///tmp/buh'),
'file://tmp/buh': FilePath('file:///home/user/tmp/buh'),
'file:///tmp/buh': FilePath('file:///tmp/buh'),
} |
I'm seeing this issue in both macos and linux
The variant "file://var/tmp" gives me the contents of "/tmp". The other variants work as expected.
The text was updated successfully, but these errors were encountered: