Closed Bug 412452 Opened 17 years ago Closed 16 years ago

Mac: Firefox/Mozilla Save Page As operation does not properly handle filenames with internal / characters (slashes)

Categories

(Firefox :: Shell Integration, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 393488

People

(Reporter: hiller.moz, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11

It is legal for / to appear in filenames on the Mac, but Firefox has issues if I try to save a page to a file with a / in the filename. If you try to enter such a path, saving the page silently fails.

I can reproduce the problem on both OS 10.4 and 10.5.

There's a related bug in Google AdWords Editor (a project I work on here at G.) I haven't looked too closely at the corresponding Mozilla code, but here's what happens with our stuff:

We instantiate an nsIFilePicker, fp.

We call fp.show().

We check the results of fp.show() call, and extract fp.file if appropriate.

When the file path specified has an internal slash, fp.file is a real, non-null nsIFile object, but our attempts to write to it later on (in C++ code) fail immediately.

Reproducible: Always

Steps to Reproduce:
1. View any web page
2. File->Save Page As.
3. Enter a path to save the page that includes a /
4. Select "Web Page, HTML only" in the format dropdown.
5. Click Save.
Actual Results:  
Save operation silently fails.

Expected Results:  
The web page being viewed is saved in the specified location with the specified filename.
Summary: Mac: Firefox/Mozilla Save Page As dialog does not properly handle filenames with internal / characters (slashes) → Mac: Firefox/Mozilla Save Page As operation does not properly handle filenames with internal / characters (slashes)
Having probed further here:

The problem is that Mac nsFilePicker implementation fails to represent the path to these files with internal slashes in their names correctly. Let's say that I want to save a file with the name "internal/slash.txt" in directory /some/directory/or/other.

I can navigate to /some/directory/or/other with the file picker, and say that I want my filename to be internal/slash.txt  . From there, the directory and filename seem to be concatenated together to determine the path that I really want: the machinery decides that I want to write to slash.txt in the directory /some/directory/or/other/internal. This directory likely does not exist. Casual inspection of fp.file and fp.fileURL confirms that this is what's happening.

I haven't probed any more deeply than that. The limitation does not seem to be in effect if I'm reading a file that I've chosen with the file picker, btw; if I do an operation that reads from an existing file that has an internal slash in the name things seem to work.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago16 years ago
Resolution: --- → DUPLICATE
Presumably matti didn't mean to un-dupe it ;)
Status: RESOLVED → VERIFIED
i meant it because bug 407222 is Camino
Status: VERIFIED → RESOLVED
Closed: 16 years ago16 years ago
Oh, heh. Good point. Forgot the save code is different.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.