@@ -127,7 +127,10 class RepositoriesController < ApplicationController | |||||
127 | (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || |
|
127 | (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || | |
128 | ! is_entry_text_data?(@content, @path) |
|
128 | ! is_entry_text_data?(@content, @path) | |
129 | # Force the download |
|
129 | # Force the download | |
130 |
send_ |
|
130 | send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) } | |
|
131 | send_type = Redmine::MimeType.of(@path) | |||
|
132 | send_opt[:type] = send_type.to_s if send_type | |||
|
133 | send_data @content, send_opt | |||
131 | else |
|
134 | else | |
132 | # Prevent empty lines when displaying a file with Windows style eol |
|
135 | # Prevent empty lines when displaying a file with Windows style eol | |
133 | # TODO: UTF-16 |
|
136 | # TODO: UTF-16 |
@@ -98,8 +98,7 class RepositoriesFilesystemControllerTest < ActionController::TestCase | |||||
98 | with_settings :file_max_size_displayed => 1 do |
|
98 | with_settings :file_max_size_displayed => 1 do | |
99 | get :entry, :id => PRJ_ID, :path => ['japanese', 'big-file.txt'] |
|
99 | get :entry, :id => PRJ_ID, :path => ['japanese', 'big-file.txt'] | |
100 | assert_response :success |
|
100 | assert_response :success | |
101 | # TODO: 'text/plain' |
|
101 | assert_equal 'text/plain', @response.content_type | |
102 | assert_equal 'application/octet-stream', @response.content_type |
|
|||
103 | end |
|
102 | end | |
104 | end |
|
103 | end | |
105 | else |
|
104 | else |
@@ -222,8 +222,7 class RepositoriesMercurialControllerTest < ActionController::TestCase | |||||
222 | def test_entry_binary_force_download |
|
222 | def test_entry_binary_force_download | |
223 | get :entry, :id => PRJ_ID, :rev => 1, :path => ['images', 'edit.png'] |
|
223 | get :entry, :id => PRJ_ID, :rev => 1, :path => ['images', 'edit.png'] | |
224 | assert_response :success |
|
224 | assert_response :success | |
225 | # TODO: 'image/png' |
|
225 | assert_equal 'image/png', @response.content_type | |
226 | assert_equal 'application/octet-stream', @response.content_type |
|
|||
227 | end |
|
226 | end | |
228 |
|
227 | |||
229 | def test_directory_entry |
|
228 | def test_directory_entry |
General Comments 0
You need to be logged in to leave comments.
Login now