Save as: should add extension to match content type



Core Graveyard
File Handling
18 years ago
2 years ago


(Reporter: Jesse Ruderman, Assigned: Scott MacGregor)


(Blocks: 1 bug, {helpwanted, pp})

helpwanted, pp
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)




18 years ago
If the extension of a webpage document isn't given in the URL, or if the 
extension in the URL doesn't match one of the recognized extensions for the 
content, mozilla should add an extension to make the saved file be the correct 
type to ensure that nothing gets lost.

URL                          DEFAULT          FILE TYPE              index.html       Webpage (*.html, *.htm)    index.html       Webpage (*.html, *.htm)     index.htm        Webpage (*.html, *.htm)   cgi.exe.html     Webpage (*.html, *.htm)   cgi.cgi.html     Webpage (*.html, *.htm) image.cgi.gif    GIF Image (*.gif)    depending on image.cgi.jpg    JPG Image (*.jpg)    the image

For each of those, there would also be an "all files (*.*)" option.

I'm not sure how much of this is specific to Win32.

This should probably only apply to http and https.


18 years ago
Ever confirmed: true

Comment 1

18 years ago
moving to XPapps, should belong there.
Assignee: cbegle → don
Component: Browser-General → XPApps
QA Contact: asadotzler → paulmac

Comment 2

18 years ago
es una dupa, sairuh?
QA Contact: paulmac → sairuh
bug exists for index files not getting name (and extension): bug 24817.

bill, d'you remember the bug for cgi file saving? it rings familiar...
Assignee: don → law

Comment 4

18 years ago
Yes, and I speculated that I had such a bug in comments I added to yet another 
bug like this one.  However, I can't find any such bug in my current list.  So, 
I think we should keep this one, especially since it does such a good job of 
mentioning *all* the problem areas.

Comment 5

18 years ago
One thing I forgot to mention explicitly: if a URL ends in .gif but the server 
gives sends jpeg image (along with a content-type consistent with jpeg), the 
file should be saved as *.jpg or as *.gif.jpg, because most (Win32?) programs 
won't figure out that the extension is wrong when trying to read the file later.

I've never actually seen a site put bogus extensions in its URLs, but I 
wouldn't be surprised to see a site try to prevent its users from saving images 
this way.


18 years ago
Target Milestone: --- → M16

Comment 6

18 years ago
I disagree with this idea.  I remember back in IE 3.x somewhere where it was 
impossible to save some files because the browser insisted that it wanted to 
add an extension of its own choosing.  If this goes in, it should be a 


Comment 7

18 years ago
Well, I'm sure this would be done in mozilla in a way that wouldn't prevent you 
from removing the added extension.


18 years ago
Target Milestone: M16 → Future
Component: XP Apps → XP Apps: GUI Features
Keywords: helpwanted

Comment 8

18 years ago
according to bug 22861, it is possible for cgi scripts to suggest a filename.

Comment 9

18 years ago
wrt Jason Heard, I presume that this is only a suggested file name/type, and 
since the user can select some other type and some other name....

I also expect we support save as "this.arbitrary", where the quotes force the 
dropdown specified extension to be ignored, so the file gets the exact name 
typed w/in the quotes.
Keywords: mozilla1.0
OS: Windows 98 → All
Hardware: PC → All


17 years ago
Blocks: 66836

Comment 10

17 years ago
Related: bug 67901, "When saving files, file widget should be initialized with 
page title" (instead of with filename on server).

Comment 11

17 years ago
See also bug 87888, file extension in content-disposition header not used in 
file-picker filter
->giving to mscott for the nonce, while bill is away...
Assignee: law → mscott


17 years ago
Keywords: mostfreq

Comment 13

17 years ago
I agree that it should automagically detect what type of file it's dealing with
and providing the default extension.

This would be best when dealing with ASPs or CGIs that give you images but don't
really include the extension anywhere in the url. Maybe you could get what type
of image it is from ImgLib and give that as the default.

Maybe even do the same thing with text, like if a page has no HTML tags in there
or no shell commands or something suggest saving as .txt

Comment 14

17 years ago
on windows the mime type registry goes from mimetype to default extension, we 
should use that for matching.
spam: over to File Handling. i have not changed the assigned developer [or the
other fields for that matter], so if anyone realizes that a bug should have a
more appropriate owner, go ahead and change it. :)
Component: XP Apps: GUI Features → File Handling


17 years ago
Depends on: 28209
*** Bug 106867 has been marked as a duplicate of this bug. ***


17 years ago
Keywords: pp
Hardware: All → PC
This is now fixed, modulo bug 57113.  The fix landed as part of the "save
complete page" changes.
Last Resolved: 16 years ago
Resolution: --- → FIXED
rs vrfy --related / newer bugs are filed separately.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.