-
Notifications
You must be signed in to change notification settings - Fork 56
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
Consider Including Drive Letter in Uri.path [Windows] #160
Comments
Thanks for the idea @EmmaJaneBonestell. I'm not too familiar with desirable Windows behaviour, and am paging in @dra27 @jonahbeckford to see if they have any opinions on this. Conforming to RFC 8089 seems sensible to me at any rate. |
The Microsoft You can see the result in PowerShell: C:\temp> New-Object System.Uri("C:\Program Files (x86)\")
AbsolutePath : C:/Program%20Files%20(x86)/
AbsoluteUri : file:///C:/Program%20Files%20(x86)/
LocalPath : C:\Program Files (x86)\
Authority :
HostNameType : Basic
IsDefaultPort : True
IsFile : True
IsLoopback : True
PathAndQuery : C:/Program%20Files%20(x86)/
Segments : {/, C:/, Program%20Files%20(x86)/}
IsUnc : False
Host :
Port : -1
Query :
Fragment :
Scheme : file
OriginalString : C:\Program Files (x86)\
DnsSafeHost :
IdnHost :
IsAbsoluteUri : True
UserEscaped : False
UserInfo : So yes, including But I think Microsoft is right in that the path should not have backslashes in it. Is that what Uri.Path is returning today? https://www.ietf.org/rfc/rfc2396.txt Section 3 (Page 10) is clear on (forward) slashes:
and it labels as "unwise" the use of backslash higher on the same Page 10:
Is it too much to ask for a fixup of forward slashes to get proper Windows URI compliance? |
Actually I'm seeing a different problem; the applications I'm interating with do send the URI properly encoded However, Thus I'm unsure how this should work, but for now I have to post-process all my |
VsCode for example does this massaging here: |
Yes, the leading slash is a bug. |
While RFC 3986 does not specify how to handle drive letters, the majority of implementations include the drive letter (e.g. C:\ , D:, ...) on Windows, and so omitting it does not really match up with real-world behavior or applications. Newer RFCs/standards also use this behavior, e.g. RFC 8089 , WhatWG .
Without it, it is impossible to use solely Uri.path to return a path on the non-current drive.
Examples:
Both return:
which only gives a path on the current drive, while, I feel, a more appropriate result would be:
Inconsistently, in these basic examples, using Uri.to_string (instead of Uri.path) will return with the drive letter.
The text was updated successfully, but these errors were encountered: