Closed Bug 1246475 Opened 9 years ago Closed 1 year ago

file:/// URL containing %2F not working on windows

Categories

(Core :: Networking, defect, P3)

44 Branch
Unspecified
Windows
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: sworddragon2, Unassigned, Mentored)

Details

(Keywords: good-first-bug, testcase, Whiteboard: [necko-backlog])

Attachments

(5 files)

Attached file testcase.html
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0 Build ID: 20160125225657 Steps to reproduce: 1. Download the testcase from the attachments. 2. Create the folder subdir in the same directory where the testcase is. 3. Create in subdir the file test.txt and write something in it. 4. Open the testcase and click all 4 links. Actual results: In Firefox (Linux) and Google Chrome (Windows and Linux) Link 1, Link 3 and Link 4 are working but in Firefox (Windows) only Link 1 and Link 3 are working. Expected results: Probably Link 4 should also work in Firefox on Windows.
Status: UNCONFIRMED → NEW
Component: Untriaged → Networking
Ever confirmed: true
Keywords: testcase
Product: Firefox → Core
Summary: Inconsistent behavior on opening encoded URL's → Inconsistent behavior when opening encoded URL
Attached file testcase pack.zip
For regular URLs this seems to work just fine. The problem seems to be for file:/// URLs. Most likely because %2F unescapes to / instead of \ ... and on windows this causes a problem when trying to open the file. This requires a platform specific fix - mainly replacing %2F with \ in nsURLHelperWin.cpp in net_GetFileFromURLSpec, before doing NS_UnescapeURL(path).
Mentor: valentin.gosu
OS: Unspecified → Windows
Summary: Inconsistent behavior when opening encoded URL → file:/// URL containing %2F not working on windows
Whiteboard: [necko-backlog] [good first bug]
Hi! I'd like to work bug.
You can have it.
Assignee: nobody → dylan.seago
Status: NEW → ASSIGNED
Dylan, if you're having trouble with the bug let me know if I can help. If you don't have time to take care of this right now, we can assign it to someone else in the mean time.
Attached patch Suggested patchSplinter Review
Attached patch Suggested path 2Splinter Review
Fixed typo in initial patch suggestion
Thanks for the patch, Dylan. If you don't mind, please move that line outside the if (!directory.IsEmpty()) block. This patch wouldn't fix use case in comment 0. Also, I think we need to replace both %2F and %2f. You can apply attachment 8739280 [details] [diff] [review], build Firefox with ./mach build, then run the test with ./mach test netwerk/test/unit/test_file_protocol.js If you need more info about hacking on Firefox feel free to ask, or you can check out the great resources at http://codefirefox.com/ Thanks!
Is this bug even valid? For example, Apache will treat <https://www.mozilla.jp/static/images/home%2ffirefox-20140310.png> and <https://www.mozilla.jp/static/images/home/firefox-20140310.png> are different. Why it does not on file: urls? Is this one of "all but us treat %2f in file: urls as /, so we will have to follow for web compat" things?
(In reply to Masatoshi Kimura [:emk] from comment #10) > Is this one of "all but us treat > %2f in file: urls as /, so we will have to follow for web compat" things? Web compat is indeed an issue, but more important is the fact that we have different behaviours on Linux and Windows.
Then we should disallow %2f on Linux rather than allowing it on Windows. Other wise the site will suddenly stop to work when uploaded.
Priority: -- → P1
Priority: P1 → P3
let's check one by one. link no 2 is not working because google has blocked google.com and changed it to country redirection,even though use it,it wonot work. link no 4 is not working because here,subdir%2Ftest.txt is invalid path. you should remove %2f and place back slash there it look like this "subdir/test.txt".. check now all the 3 links works...
Keywords: good-first-bug
Whiteboard: [necko-backlog] [good first bug] → [necko-backlog]

the assignee was disabled

Assignee: dylan.seago → nobody
Status: ASSIGNED → NEW
Severity: normal → S3

Testing in the latest Chrome (Version 120.0.6099.130) shows only links 1 and 3 working. Link 4 gives:

This site can’t be reached
The webpage at file:///J:/Misc/Firefox/subdir%2Ftest.txt might be temporarily down or it may have moved permanently to a new web address.
ERR_INVALID_URL

Firefox displays a blank page for link 4, no error message.

Should this bug be closed?

Yes, thank you for checking this.
It seems like all browsers agree now.
Closing as WORKSFORME - though it's the other browsers that have changed their behaviour.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: