diff options
author | Leonel Galán <leonel@getstealz.com> | 2017-05-17 15:23:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-17 15:23:21 -0400 |
commit | 0804e58e1e6a52190a950f863622102b6b21ccb8 (patch) | |
tree | a2d9887906bd2c472edc54907362b93a57f52f0f /actionpack/lib/action_dispatch/http | |
parent | f5b2a0ef408f01dd9f12b456f5e4bb41ebb4cb76 (diff) | |
parent | 385d9af299fbfac7f063de214d371545bafef5df (diff) | |
download | rails-0804e58e1e6a52190a950f863622102b6b21ccb8.tar.gz rails-0804e58e1e6a52190a950f863622102b6b21ccb8.tar.bz2 rails-0804e58e1e6a52190a950f863622102b6b21ccb8.zip |
Merge branch 'master' into bug/filtered_parameters_class
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r-- | actionpack/lib/action_dispatch/http/mime_type.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/http/parameters.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/http/upload.rb | 8 |
3 files changed, 17 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb index 0cf010f59e..74a3afab44 100644 --- a/actionpack/lib/action_dispatch/http/mime_type.rb +++ b/actionpack/lib/action_dispatch/http/mime_type.rb @@ -326,11 +326,11 @@ module Mime def ref; end - def respond_to_missing?(method, include_private = false) - method.to_s.ends_with? "?" - end - private + def respond_to_missing?(method, _) + method.to_s.ends_with? "?" + end + def method_missing(method, *args) false if method.to_s.ends_with? "?" end diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb index 79a2ef965b..7c585dbe68 100644 --- a/actionpack/lib/action_dispatch/http/parameters.rb +++ b/actionpack/lib/action_dispatch/http/parameters.rb @@ -85,7 +85,7 @@ module ActionDispatch def set_binary_encoding(params) action = params[:action] - if controller_class.binary_params_for?(action) + if binary_params_for?(action) ActionDispatch::Request::Utils.each_param_value(params) do |param| param.force_encoding ::Encoding::ASCII_8BIT end @@ -93,6 +93,12 @@ module ActionDispatch params end + def binary_params_for?(action) + controller_class.binary_params_for?(action) + rescue NameError + false + end + def parse_formatted_parameters(parsers) return yield if content_length.zero? || content_mime_type.nil? diff --git a/actionpack/lib/action_dispatch/http/upload.rb b/actionpack/lib/action_dispatch/http/upload.rb index 61ba052e45..225272d66e 100644 --- a/actionpack/lib/action_dispatch/http/upload.rb +++ b/actionpack/lib/action_dispatch/http/upload.rb @@ -27,14 +27,18 @@ module ActionDispatch @tempfile = hash[:tempfile] raise(ArgumentError, ":tempfile is required") unless @tempfile - @original_filename = hash[:filename] - if @original_filename + if hash[:filename] + @original_filename = hash[:filename].dup + begin @original_filename.encode!(Encoding::UTF_8) rescue EncodingError @original_filename.force_encoding(Encoding::UTF_8) end + else + @original_filename = nil end + @content_type = hash[:type] @headers = hash[:head] end |