Closed Bug 314846 Opened 19 years ago Closed 17 years ago

exthandler doesn't remove : colon from mac file names (Random filename after downloading)

Categories

(Core Graveyard :: File Handling, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9alpha6

People

(Reporter: kylepenner, Assigned: Mardak)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051025 Firefox/1.5
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051025 Firefox/1.5

When I click "Retrieve" on the first image, FF downloads the file, but it loses the .fits.gz extension and instead of its proper filename, there's a random bunch of letters.

Reproducible: Always

Steps to Reproduce:
1.  Click on "Retrieve"
2.  Download the file

Actual Results:  
A random filename.gz is downloaded instead of filename.fits.gz.

Expected Results:  
The file should have the same name as that given in the "Retrieve" link.
Summary: Mangled filename after downloading → Random filename after downloading
Related to Camino bug 209645 -> Camino bug 181815?
(In reply to comment #1)
> Related to Camino bug 209645 -> Camino bug 181815?
> 

Possibly.  I never had this problem with Firefox 1.0.7, and now all of a sudden this behavior occurs.
Good thing the provided URL still works. :)

The file remains as the random filename because it's trying to save the file, but it contains ":", which I believe is the only invalid character on OS X for a file name.

Does FILE_ILLEGAL_CHARACTERS need to be defined to ":" on for Mac? It's used when constructing ExternalAppHandler (originally added for bug 100591 and old mac classic bits removed by joshmoz)

http://mxr.mozilla.org/mozilla/source/xpcom/ds/nsCRT.h#273
http://mxr.mozilla.org/mozilla/source/uriloader/exthandler/nsExternalHelperAppService.cpp#1472

It seems to be failing at the call to PromptForSaveToFile from SaveToDisk when it tries to use mSuggestedFileName.

Interesting to note: this doesn't affect save-as or alt-click that use webbrowserpersist.
Status: UNCONFIRMED → NEW
Component: Download Manager → File Handling
Ever confirmed: true
Product: Firefox → Core
QA Contact: download.manager → file-handling
Summary: Random filename after downloading → exthandler doesn't remove : colon from mac file names (Random filename after downloading)
Attached patch v1Splinter Review
Adds the colon to illegal character for os x, before unix.

As a side note, validateFileName of contentAreaUtils converts ":"s into "_" while exthandler makes them "-"s.. (everything becomes "-"s in exthandler while windows has some special cases to "'" " " "(" ")") Perhaps exthandler should at least be consistent on mac/unix by replacing with "_" instead of "-".

http://mxr.mozilla.org/mozilla/source/toolkit/content/contentAreaUtils.js#808
Assignee: nobody → edilee
Status: NEW → ASSIGNED
Attachment #268699 - Flags: review?(benjamin)
"Perhaps exthandler should at least be consistent on mac/unix by replacing with "_" instead of "-"."

Sounds like a good idea to me, can you file a bug and post a patch?
Attachment #268699 - Flags: review?(benjamin) → review+
(In reply to comment #5)
> "Perhaps exthandler should at least be consistent on mac/unix by replacing with
> "_" instead of "-"."
> 
> Sounds like a good idea to me, can you file a bug and post a patch?

-> Bug 384856 :)
Whiteboard: [checkin needed]
Checking in xpcom/ds/nsCRT.h;
new revision: 3.78; previous revision: 3.77
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Target Milestone: --- → mozilla1.9alpha6
Version: unspecified → Trunk
Blocks: 202133
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: