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)
show_error_not_found and return unless @content
if 'raw' == params[:format] || @content.is_binary_data? || (@entry.size && @entry.size > Setting.file_max_size_displayed.to_i.kilobyte)
# Force the download
send_data @content, :filename => @path.split('/').last
fn = @path.split('/').last
type = Redmine::MimeType.of(fn) #Get the Mime-Type of the File
if type
send_data @content, :filename => fn, :type => type, :disposition => 'inline'
else
send_data @content, :filename => fn
end
else
# Prevent empty lines when displaying a file with Windows style eol
@content.gsub!("\r\n", "\n")
(3-3/3)