Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Normalize file parameters in same place as other parameters (ActionDi…

…spatch::Http::Parameters#normalize_encode_params)
  • Loading branch information...
commit 5e6a8b911906ba0afb76b6c8ce8a916a31c8d3b1 1 parent a4d4af4
@robertomiranda robertomiranda authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.