Last Comment Bug 395576 - Downloaded files get upper case extension after move (OS2's isExecutable() causes file extensions to be uppercased)
: Downloaded files get upper case extension after move (OS2's isExecutable() ca...
: verified1.8.1.8
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: unspecified
: Other OS/2
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Nathan Froyd [:froydnj]
Depends on:
  Show dependency treegraph
Reported: 2007-09-09 04:16 PDT by Peter Weilbacher
Modified: 2007-10-03 06:32 PDT (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

use extra buffer (1.59 KB, patch)
2007-09-09 14:55 PDT, Peter Weilbacher
mozilla: review+
Details | Diff | Splinter Review

Description Peter Weilbacher 2007-09-09 04:16:44 PDT
When downloading files from some servers, the downloaded filename has an upper-cased extension after it was moved to the final destination.

To reproduce:
- go to
- click on the link
- the download begins
- during the download one one can see two files in the destination directory, and mzfntcfgft_20070528.ZIP.part
- when the download has completed, the final file name is mzfntcfgft_20070528.ZIP

Expected result:
It should be named

This happens with Firefox 2.0.0.x but not with SeaMonkey 1.1.x or 2.0a1pre.
Comment 1 Shawn Wilsher :sdwilsh 2007-09-09 07:03:54 PDT
Seamonkey uses completely different download manager code.

Does this work the same on trunk?
Comment 2 Peter Weilbacher 2007-09-09 11:14:23 PDT
Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.9a8pre) Gecko/2007090919 Minefield/3.0a8pre
No, this trunk build behaves exactly the same.
Comment 3 Peter Weilbacher 2007-09-09 14:51:25 PDT
This is caused by isExecutable() that is called from the validateLeafName function in nsHelperAppDlg.js. Apparently this does not happen for SeaMonkey?

I have looked at that code before and didn't notice that it works on the input char string instead of copying it into an extra buffer before uppercasing it for comparison...
Comment 4 Peter Weilbacher 2007-09-09 14:55:46 PDT
Created attachment 280273 [details] [diff] [review]
use extra buffer

This should do it. It also removes the non-high memory WinUpper fallback because that is really not needed.
Comment 5 Phil Parker 2007-09-09 21:32:03 PDT
Interesting. Using Tabmixplus 0.3.6 with "Prevent blank tabs when downloading files" NOT checked and "Save link as..." it comes out *.zip. Clicking directly on the file name as Peter described yields *.ZIP as reported.
Comment 6 Peter Weilbacher 2007-09-10 01:31:49 PDT
Phil, "Save link as..." first presents you a file picker dialog, right? Whatever you type in it should override any other guesses.
Comment 7 Phil Parker 2007-09-11 02:00:34 PDT
(In reply to comment #6)
> Phil, "Save link as..." first presents you a file picker dialog, right?
> Whatever you type in it should override any other guesses.

I thought it would, but it doesn't. 

Both present me with the "file picker" dialog, with the .zip lowercase. One stays that way, the other changes.

Getting PS files from ( in the US) the "file picker" presents with no extension. Adding .ps results in *.PS on disk, because effectively direct click is the only way allowed.
Comment 8 Peter Weilbacher 2007-09-16 13:57:51 PDT
Fix checked in to trunk and 1.8 branch.
Comment 9 Peter Weilbacher 2007-10-03 06:32:38 PDT
Verified as fixed with the branch nightly
   Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:
   Gecko/20071003 BonEcho/
and my own build from trunk
   Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.9a9pre)
   Gecko/2007100301 Minefield/3.0a9pre

I also verified that file extensions added to files when downloading from (via Save Link As... from the context menu) stay lower case.

Note You need to log in before you can comment on or make changes to this bug.