Closed Bug 288654 Opened 20 years ago Closed 20 years ago

Accessing a file:/// resource using + characters for spaces doesn't work.

Categories

(Firefox :: Address Bar, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: tommyjb, Assigned: bugs)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

When accessing a local resource which has one or more spaces in the file name,
you should, to the best of my knowledge, be able to substitute those spaces with
+ characters.  However, this causes Firefox to be unable to find the resource.

Note that this only applies to *local* resources.  Here is an example of a
remote URL that contains + characters in place of spaces, which Firefox has no
trouble with: http://snipsnap.org/space/Foo+Bar+Baz

Reproducible: Always

Steps to Reproduce:
1. Navigate to a file with spaces in the name, substituting + characters for
those spaces; example: 'file:///c:/foo+bar' for 'c:\foo bar'.
Actual Results:  
I observed Firefox report a 'not found' error.

Expected Results:  
Firefox should've opened 'c:\foo bar'.

Work-around: use %20 in place of any spaces.
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050401
Firefox/1.0+
Clicking on http://snipsnap.org/space/Foo+Bar+Baz works for me
oh for the love of... plse ignore comment 1 - reporter says this link works.
need to test a local file
I concur. I made a file called: C:\text file.txt

file:///c:/text%20file.txt works
file:///c:/text+file.txt does not work

yet http://snipsnap.org/space/Foo+Bar+Baz works fine, resolving + to ' ' (space)
A space must be escaped as %20.
The example URL is invalid because in that case the webserver serves the same
document for both URLs (and both URLs are different).

Example (from my holidays):
http://matti.no-ip.org/egypt+dive.jpg
http://matti.no-ip.org/egypt%20dive.jpg
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
(In reply to comment #4)
> A space must be escaped as %20.

Hmm... but Microsoft .NET's HttpUtility.UrlEncode method converts spaces to plus
signs:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebHttpUtilityClassUrlEncodeTopic3.asp
that seems to be a bug (or whatever) in Microsoft .NET's HttpUtility.UrlEncode
method.
A long, long time ago there was code to convert a space into + to encode it (and
backwards). Mozilla supported that too because the old netlib code from Netscape
did that also. However this is not covered by any RFC, just a convenience
function that colides with the usual (RFC compliant) encoding scheme. For that
reason it was removed. Some http servers support it on the server side, this
must be the reason you see it working on a http server. However with the file
protocol there is no one to support that legacy stuff, so it does not work in
mozilla. So it is no bug, but non standard compliant stuff in Microsofts code.
Use %20 instead of + to be on the save side.
You need to log in before you can comment on or make changes to this bug.