Project

General

Profile

Feature #2209 » dl_repo_files_with_MimeType_r2823.patch

Chris Grieger, 2009-07-18 18:16

View differences:

app/controllers/repositories_controller.rb (working copy)
119 119
    show_error_not_found and return unless @content
120 120
    if 'raw' == params[:format] || @content.is_binary_data? || (@entry.size && @entry.size > Setting.file_max_size_displayed.to_i.kilobyte)
121 121
      # Force the download
122
      send_data @content, :filename => @path.split('/').last
122
      fn = @path.split('/').last
123
      type = Redmine::MimeType.of(fn) #Get the Mime-Type of the File
124
      if type
125
        send_data @content, :filename => fn, :type => type, :disposition => 'inline'
126
      else
127
        send_data @content, :filename => fn
128
      end
129

  
123 130
    else
124 131
      # Prevent empty lines when displaying a file with Windows style eol
125 132
      @content.gsub!("\r\n", "\n")
(3-3/3)