aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobertomiranda <rjmaltamar@gmail.com>2013-08-14 17:59:27 -0500
committerrobertomiranda <rjmaltamar@gmail.com>2013-08-14 21:16:08 -0500
commit5e6a8b911906ba0afb76b6c8ce8a916a31c8d3b1 (patch)
tree1dd35901b84ae2f0c83d43ea6de9b841a82de1e2
parenta4d4af4083d4b41c348f7e707874aedfa1d8a3cd (diff)
downloadrails-5e6a8b911906ba0afb76b6c8ce8a916a31c8d3b1.tar.gz
rails-5e6a8b911906ba0afb76b6c8ce8a916a31c8d3b1.tar.bz2
rails-5e6a8b911906ba0afb76b6c8ce8a916a31c8d3b1.zip
Normalize file parameters in same place as other parameters (ActionDispatch::Http::Parameters#normalize_encode_params)
-rw-r--r--actionpack/lib/action_dispatch/http/parameters.rb2
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb1
-rw-r--r--actionpack/lib/action_dispatch/http/upload.rb13
3 files changed, 2 insertions, 14 deletions
diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb
index 8e992070f1..8e46441d24 100644
--- a/actionpack/lib/action_dispatch/http/parameters.rb
+++ b/actionpack/lib/action_dispatch/http/parameters.rb
@@ -59,6 +59,8 @@ module ActionDispatch
def normalize_encode_params(params)
if params.is_a?(String)
return params.force_encoding(Encoding::UTF_8).encode!
+ elsif Hash === params && params.has_key?(:tempfile)
+ return UploadedFile.new(params)
elsif !params.is_a?(Hash)
return params
end
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index b4cf8ad2f7..aba8f66118 100644
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -18,7 +18,6 @@ module ActionDispatch
include ActionDispatch::Http::MimeNegotiation
include ActionDispatch::Http::Parameters
include ActionDispatch::Http::FilterParameters
- include ActionDispatch::Http::Upload
include ActionDispatch::Http::URL
autoload :Session, 'action_dispatch/request/session'
diff --git a/actionpack/lib/action_dispatch/http/upload.rb b/actionpack/lib/action_dispatch/http/upload.rb
index b57c84dec8..a8d2dc3950 100644
--- a/actionpack/lib/action_dispatch/http/upload.rb
+++ b/actionpack/lib/action_dispatch/http/upload.rb
@@ -73,18 +73,5 @@ module ActionDispatch
filename.force_encoding(Encoding::UTF_8).encode! if filename
end
end
-
- module Upload # :nodoc:
- # Replace file upload hash with UploadedFile objects
- # when normalize and encode parameters.
- def normalize_encode_params(value)
- if Hash === value && value.has_key?(:tempfile)
- UploadedFile.new(value)
- else
- super
- end
- end
- private :normalize_encode_params
- end
end
end