Added a comment: file:/// must be forced to file:// on windows

This commit is contained in:
mih 2023-01-27 09:19:10 +00:00 committed by admin
parent a00513754b
commit 363412f691

View file

@ -0,0 +1,20 @@
[[!comment format=mdwn
username="mih"
avatar="http://cdn.libravatar.org/avatar/f881df265a423e4f24eff27c623148fd"
subject="file:/// must be forced to file:// on windows"
date="2023-01-27T09:19:10Z"
content="""
I just want to leave a note that the `file:` URL scheme handling on windows is still problematic. A file URL (e.g. generated by Python's `pathlib.as_uri()`) like the following does not work:
```
file:///C:/DLTMP/myarchive.zip
```
it is parsed to the path `/C:/DLTMP/myarchive.zip` (as reported by OP), which is invalid.
A workaround is to replace `file:///` with `file://` (remove one slash). This makes git-annex accept the URL and parse it to the correct path `C:/DLTMP/myarchive.zip`.
However, such a \"double-slash\" URL is invalid. [Wikipedia](https://en.wikipedia.org/wiki/File_URI_scheme) has a dedicated bit on \"How many slashes?\" which states
> file://path (i.e. two slashes, without a hostname) is never correct, but is often used
"""]]