diff options
author | Matthew Draper <matthew@trebex.net> | 2016-12-20 21:34:21 +1030 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-20 21:34:21 +1030 |
commit | 695065281e75d05f942d2a5eb6b203da8d672770 (patch) | |
tree | 512fe5d2a38b4e665b7648378f4f0a1e48c7aedb /actionpack/lib/action_controller | |
parent | a65ccb55f234b8f218be83eb5df57f3162cf7c55 (diff) | |
parent | 51a9311b2d31c77a70b2acc7c03fcd561184ff0d (diff) | |
download | rails-695065281e75d05f942d2a5eb6b203da8d672770.tar.gz rails-695065281e75d05f942d2a5eb6b203da8d672770.tar.bz2 rails-695065281e75d05f942d2a5eb6b203da8d672770.zip |
Merge pull request #27408 from matthewd/charset-fix
Only default the response charset when it is first set
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/data_streaming.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/metal/data_streaming.rb b/actionpack/lib/action_controller/metal/data_streaming.rb index f089c8423b..ec4b5cec5e 100644 --- a/actionpack/lib/action_controller/metal/data_streaming.rb +++ b/actionpack/lib/action_controller/metal/data_streaming.rb @@ -70,7 +70,6 @@ module ActionController #:nodoc: send_file_headers! options self.status = options[:status] || 200 - self.content_type = options[:type] if options.key?(:type) self.content_type = options[:content_type] if options.key?(:content_type) response.send_file path end @@ -113,6 +112,9 @@ module ActionController #:nodoc: def send_file_headers!(options) type_provided = options.has_key?(:type) + self.content_type = DEFAULT_SEND_FILE_TYPE + response.sending_file = true + content_type = options.fetch(:type, DEFAULT_SEND_FILE_TYPE) raise ArgumentError, ":type option required" if content_type.nil? @@ -137,8 +139,6 @@ module ActionController #:nodoc: headers["Content-Transfer-Encoding"] = "binary" - response.sending_file = true - # Fix a problem with IE 6.0 on opening downloaded files: # If Cache-Control: no-cache is set (which Rails does by default), # IE removes the file it just downloaded from its cache immediately |