Needs review
Project:
Filemanager
Version:
master
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jul 2006 at 09:41 UTC
Updated:
22 Sep 2006 at 22:23 UTC
Jump to comment: Most recent file
Hi there,
I have PDF's uploaded using filemanager and the attachment module. The user should be able to 1) open them using the browser or 2) right-click and choose save target as/save links as.
The problem occurs when trying to save the pdf, everything works fine in IE and Opera - but in Firefox the browser insists on adding .htm to the end of the filename.
e.g.
testDoc.pdf.htm
This is easy to fix if you simply take off the .htm in the save window, but potential users of the site will not understand the filetype issue.
Is this to do with MIME types with Firefox? Im at lost?
Any ideas?
Cheers
James
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | filemanager.module_0.patch | 649 bytes | alex_ost |
Comments
Comment #1
drewish commentedI've commited a fix to #49632 that might fix this. Please re-open the issue if you're still having the problem.
Comment #2
alex_ost commentedHi,
There is a bug in current firefox (lasts since a while now) which prevents doing it. For one time, IE seems to handle things better...
In short : let's assume that the file is served through dynamic URL (something like http://yoursite.com/filemanager/active?fid=30). When the user right-clicks "save link as" Firefox doesn't send a request to get the actual filename from the headers (Content-Disposition), but rathers tries to guess it from the URL. The Firefox guys decided to do so in order to make Firefox more responsive (no need to wait for the server response to display the save as dialog). So the filename is not correct...
On the other side, IE sends an HTTP requests, and parses the response headers to get the filename. Which make a more friendly behavior.
The only case where Firefox is guessing the right filename is when the user clicks on the link (not right-clicks, a regular click) and when the server answers with a Content-Disposition : attachment. This forces Firefox to opens the "save as" dialog with the correct filename. But it prevents the user to view the pdf file directly in the browser...
There have been a loooooong discussion about this behaviour, but it seems that Firefox developpers don't want to actually change it. For more information :
https://bugzilla.mozilla.org/show_bug.cgi?id=299372#c89
The only way to get a correct behaviour whatever the browser is to serve files from firect URL (http://yoursite.com/blablabla/file.pdf).
For my site, I finally went with "Content-disposition : inline" which leads to :
- correct behaviour for IE users (both for inline view and "save link as")
- let Firefox users to view the pdf inline
- but Firefox users have to type the correct filename when doing "save link as"
For this, I has to patch filemanager.module to send all attachments inline... By the way I add a few headers so that IE opens zip, avi (...) files correctly...
Hope this helps a bit.
Alex
Comment #3
drewish commentedyou should use example.com for sample links. the domain name is set aside specifically for this purpose.
i'd like to get some feed back from other people on this patch.
Comment #4
alex_ost commented1) Sorry for the site name, I didn't know about example.com. Now I do, thank you :)
2) For the patch, I didn't mean to include it in filemanager module (and btw sorry for my poor english). I just included it for reference for people experiencing similar issues. But IMHO, Content-Disposition inline is currently mainly a matter of taste :) An other way to make the situation correct would be to display file with two links :
This way both browser would handle things correctly (I don't know about other browsers), and users wouldn't be confused. Just my 2 cents...
Comment #5
alex_ost commentedAfter thinking a while, this doesn't belong to filemanager module, but rather to attachment module, as headers can be overriden there and many modules using filemanager may have different requirements. Moving a patch to attachment module issues #85610).