{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/url/issues/103","repository_url":"https://api.github.com/repos/whatwg/url","labels_url":"https://api.github.com/repos/whatwg/url/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/url/issues/103/comments","events_url":"https://api.github.com/repos/whatwg/url/issues/103/events","html_url":"https://github.com/whatwg/url/issues/103","id":142433935,"number":103,"title":"URL.pathname getter for file URLs produces odd result on Windows","user":{"login":"dd8","id":16352274,"avatar_url":"https://avatars.githubusercontent.com/u/16352274?v=3","gravatar_id":"","url":"https://api.github.com/users/dd8","html_url":"https://github.com/dd8","followers_url":"https://api.github.com/users/dd8/followers","following_url":"https://api.github.com/users/dd8/following{/other_user}","gists_url":"https://api.github.com/users/dd8/gists{/gist_id}","starred_url":"https://api.github.com/users/dd8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dd8/subscriptions","organizations_url":"https://api.github.com/users/dd8/orgs","repos_url":"https://api.github.com/users/dd8/repos","events_url":"https://api.github.com/users/dd8/events{/privacy}","received_events_url":"https://api.github.com/users/dd8/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-21T18:35:15Z","updated_at":"2016-03-22T13:01:42Z","closed_at":null,"body":"The getter for URL.pathname always prefixes the pathname with / \r\nhttps://url.spec.whatwg.org/#dom-url-pathname\r\n\r\nThat produces odd results in Windows:\r\n\r\nparser.href = \"file:///C:/Folder/File4.txt\"\r\nparser.pathname returns \"/C:/Folder/File4.txt\"\r\n\r\nOn Mac/*nix platforms parser.pathname returns a valid OS pathname. On Windows the returned pathname doesn't appear to be a valid OS pathname: \r\nhttps://msdn.microsoft.com/en-gb/library/windows/desktop/aa365247%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396\r\n\r\nLooks like URL standard behaviour matches Chrome/Firefox but not IE11 where .pathname returns  \"C:/Folder/File4.txt\". \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/whatwg/url/issues/comments/199802213","html_url":"https://github.com/whatwg/url/issues/103#issuecomment-199802213","issue_url":"https://api.github.com/repos/whatwg/url/issues/103","id":199802213,"user":{"login":"dd8","id":16352274,"avatar_url":"https://avatars.githubusercontent.com/u/16352274?v=3","gravatar_id":"","url":"https://api.github.com/users/dd8","html_url":"https://github.com/dd8","followers_url":"https://api.github.com/users/dd8/followers","following_url":"https://api.github.com/users/dd8/following{/other_user}","gists_url":"https://api.github.com/users/dd8/gists{/gist_id}","starred_url":"https://api.github.com/users/dd8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dd8/subscriptions","organizations_url":"https://api.github.com/users/dd8/orgs","repos_url":"https://api.github.com/users/dd8/repos","events_url":"https://api.github.com/users/dd8/events{/privacy}","received_events_url":"https://api.github.com/users/dd8/received_events","type":"User","site_admin":false},"created_at":"2016-03-22T13:01:42Z","updated_at":"2016-03-22T13:01:42Z","body":"IE11: \"C:/Folder/File4.txt\"\r\nEdge: \"/C:/Folder/File4.txt\"\r\nChrome 49: \"/C:/Folder/File4.txt\"\r\nFF 44: \"/C:/Folder/File4.txt\"\r\nSafari 9:.0.3: \"/C:/Folder/File4.txt\"\r\n\r\nThinking about it a bit more I'm not convinced parser.pathname is always a valid OS pathname on Mac/*nix either when special filename characters (e.g. $ or *) or unicode sequences are present in the URL. \r\n\r\nThere are use cases where paths represented as file URLs need turned into local OS paths (e.g. for FileAPI and server-side JS). \r\n\r\nDoes the URL interface need another property/method to handle this? .NET has URI.LocalPath for this purpose; Cocoa has NSURL.path which can be passed to other Cocoa file APIs. \r\n\r\nSeems like there should be an API for this somewhere (even if it's not in the URL interface) since there's a long history of security issues caused by path parsing vulnerabilities."}}