Feature #2209 » MimeType.patch
| app/controllers/repositories_controller.rb (working copy) | ||
|---|---|---|
|
require 'SVG/Graph/Bar'
|
||
|
require 'SVG/Graph/BarHorizontal'
|
||
|
require 'redmine/mime_type'
|
||
|
require 'digest/sha1'
|
||
|
class ChangesetNotFound < Exception; end
|
||
| ... | ... | |
|
show_error_not_found and return unless @content
|
||
|
if 'raw' == params[:format] || @content.is_binary_data?
|
||
|
# Force the download if it's a binary file
|
||
|
send_data @content, :filename => @path.split('/').last
|
||
|
fn = @path.split('/').last
|
||
|
type = Redmine::MimeType.of(fn)
|
||
|
if type
|
||
|
send_data @content, :filename => fn, :type => type, => '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")
|
||