Browse files

Merge pull request #11891 from robertomiranda/remove_upload_module

Normalize file parameters in same place as other parameters (ActionDispatch::Http::Parameters#normalize_encode_params)
  • Loading branch information...
2 parents f97fdac + 5e6a8b9 commit ce2d837a5a27bfa9306a149233a451840790a104 @spastorino spastorino committed Aug 19, 2013
View
2 actionpack/lib/action_dispatch/http/parameters.rb
@@ -59,6 +59,8 @@ def reset_parameters #:nodoc:
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
View
1 actionpack/lib/action_dispatch/http/request.rb
@@ -18,7 +18,6 @@ class Request < Rack::Request
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'
View
13 actionpack/lib/action_dispatch/http/upload.rb
@@ -73,18 +73,5 @@ def encode_filename(filename)
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

0 comments on commit ce2d837

Please sign in to comment.