Patch #3770
text/html documents force currently firefox to open download dialog
Status: | New | Start date: | 2009-08-23 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Attachments | |||
Target version: | - |
Description
In our redmine installation, we use attach HTML documentation files under project Documentation section (such as asciidoc-generated html code). The problem is, redmine currently forces Firefox browser to open the download dialog instead to open HTML inline in the browser.
As far I traced this down, this is due to setting the Content-Disposition flag to "attachment" by redmine. I could fix this by adding test for is_text mimetype in in attachments_controller.rb:
---snip---def download
if @attachment.container.is_a?(Version) || @attachment.container.is_a?(Project)
@attachment.increment_download
end
- :disposition => (@attachment.image? ? 'inline' : 'attachment')
:disposition => ((@attachment.image? || @attachment.is_text?) ? 'inline' : 'attachment')
end
---snip---
- images are sent inline
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => @attachment.content_type,
However, I think this should be handled more in general since there might be pretty much other mimetypes where this is a problem as well.
Related issues
History
#1
Updated by Sam Kvasnica over 11 years ago
2nd try:
In our redmine installation, we attach HTML documentation files under project Documentation section (such as asciidoc-generated html code). The problem is, redmine currently forces Firefox browser to open the download dialog instead to open HTML inline in the browser.
As far I traced this down, this is due to setting the Content-Disposition flag to "attachment" by redmine. I could fix this by adding test for is_text mimetype in in attachments_controller.rb:
@ ---snip---
def download
if @attachment.container.is_a?(Version) || @attachment.container.is_a?(Project)
@attachment.increment_download
end
- images are sent inline
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => @attachment.content_type, - :disposition => (@attachment.image? ? 'inline' : 'attachment')
:disposition => ((@attachment.image? || @attachment.is_text?) ? 'inline' : 'attachment')
end
---snip---
@
However, I think this should be handled more in general since there might be pretty much other mimetypes where this is a problem as well.
#2
Updated by Sam Kvasnica over 11 years ago
- File aaa added
3rd try as attachment: verbatim code does not seem to work really...
#3
Updated by Toshi MARUYAMA almost 10 years ago
- Category set to Attachments