Project

General

Profile

Actions

Patch #3770

closed

text/html documents force currently firefox to open download dialog

Added by Sam Kvasnica about 16 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Attachments
Target version:
-
Start date:
2009-08-23
Due date:
% Done:

0%

Estimated time:

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
  1. :disposition => (@attachment.image? ? 'inline' : 'attachment')
    :disposition => ((@attachment.image? || @attachment.is_text?) ? 'inline' : 'attachment')
    end
    ---snip---
  1. 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.


Files

aaa (584 Bytes) aaa attachments_controller.rb fix Sam Kvasnica, 2009-08-23 13:38

Related issues

Related to Redmine - Defect #6256: Redmine considers non ASCII and UTF-16 text files as binary in SCMClosedToshi MARUYAMA2010-08-31

Actions
Related to Redmine - Feature #2209: MIME type support for repository EntriesClosed2008-11-17

Actions
Actions

Also available in: Atom PDF