scm: set mime type in downloading file.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5210 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2011-03-22 16:56:52 +00:00
parent cb297048df
commit f15b12556f
3 changed files with 6 additions and 5 deletions
+4 -1
View File
@@ -127,7 +127,10 @@ class RepositoriesController < ApplicationController
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
! is_entry_text_data?(@content, @path)
# Force the download
send_data @content, :filename => filename_for_content_disposition(@path.split('/').last)
send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
send_type = Redmine::MimeType.of(@path)
send_opt[:type] = send_type.to_s if send_type
send_data @content, send_opt
else
# Prevent empty lines when displaying a file with Windows style eol
# TODO: UTF-16