Backslash converted to forward slash when copying file:// url, even in query string or hash
Categories
(Core :: Networking, defect)
Tracking
()
People
(Reporter: kip.robinson, Unassigned)
References
(Depends on 1 open bug)
Details
(Whiteboard: [necko-backlog])
Attachments
(1 file)
(deleted),
text/plain
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0 Build ID: 20120312181643 Steps to reproduce: Note: This may only apply to Windows OS. 1. Open any HTML file from your local system. 2. Open console window and enter Javascript command: location.hash = 'tst=' + encodeURIComponent('\\') 3. Copy the URL from the address bar Actual results: After step 1, URL is something like: file:///C:/temp/test.html After step 2. After entering Javascript command, URL is shown as: file:///C:/temp/test.html#tst=\ After step 3, the clipboard contains: file:///C:/temp/test.html#tst=/ Problem: the backslash was changed to a forward slash. Expected results: Either: a. The URL should should have shown with the backslash encoded, as entered in Javascript: "#tst=%5C" -or- b. When copying the URL, backslashes should not be converted to forward slash in query string or in location hash. I think it is important to note that this happened even though my Javascript correctly escaped the backslash as %5C. Note: The scenario above only covers location hash, but this also happens in query string. The attached document uses HTML5 history.push to set a query string containing a backslash.
Updated•9 years ago
|
Updated•8 years ago
|
Just to note I've found this issue too - \ in the query part (?...\...) of a file: (but not http:) request entered in the address bar incorrectly changes to a / I'm surprised it's taken so long to address... I hope this comment may prod the matter forward :) Cheers, David
Updated•7 years ago
|
I don't think this is a duplicate of bug 1348876. The underlying causes are different:
Bug 1348876: The address bar decodes "%5C" into "", making the shown URL invalid (and pressing enter in the address bar causes "" to be replaced with "/").
This bug: The backslash replacing algorithm in the URL parser seemingly doesn't stop at "#" or "?" when parsing file: URLs.
Example STR: new URL("file:///#\").hash == "#/"
Oops, markdown ate some backslashes. Let's try again:
I don't think this is a duplicate of bug 1348876. The underlying causes are different:
Bug 1348876: The address bar decodes %5C
into \\
, making the shown URL invalid (and pressing enter in the address bar causes \
to be replaced with /
).
This bug: The backslash replacing algorithm in the URL parser seemingly doesn't stop at #
or ?
when parsing file: URLs.
For example, new URL("file:///#\\").hash
returns #/
Description
•