Project

General

Profile

Feature #2209 » MimeType.patch

Vincent Castellano, 2008-11-17 20:56

View differences:

app/controllers/repositories_controller.rb (working copy)
17 17

  
18 18
require 'SVG/Graph/Bar'
19 19
require 'SVG/Graph/BarHorizontal'
20
require 'redmine/mime_type'
20 21
require 'digest/sha1'
21 22

  
22 23
class ChangesetNotFound < Exception; end
......
118 119
    show_error_not_found and return unless @content
119 120
    if 'raw' == params[:format] || @content.is_binary_data?
120 121
      # Force the download if it's a binary file
121
      send_data @content, :filename => @path.split('/').last
122
      fn = @path.split('/').last
123
      type = Redmine::MimeType.of(fn)
124
      if type
125
        send_data @content, :filename => fn, :type => Redmine::MimeType.of(fn), :disposition => 'inline'
126
      else
127
        send_data @content, :filename => fn
128
      end
122 129
    else
123 130
      # Prevent empty lines when displaying a file with Windows style eol
124 131
      @content.gsub!("\r\n", "\n")
(1-1/3)