diff options
author | Eugene Kenny <elkenny@gmail.com> | 2017-06-24 00:48:34 +0100 |
---|---|---|
committer | Eugene Kenny <elkenny@gmail.com> | 2017-06-24 00:48:34 +0100 |
commit | b3966080cc825755ea665693b9529c8ef898c6cb (patch) | |
tree | eb18b0f6806fce033918e21144ec6bb7251fb83c /actionpack/lib | |
parent | 2477e1b5aa66e8308244af17abf56474d4266536 (diff) | |
download | rails-b3966080cc825755ea665693b9529c8ef898c6cb.tar.gz rails-b3966080cc825755ea665693b9529c8ef898c6cb.tar.bz2 rails-b3966080cc825755ea665693b9529c8ef898c6cb.zip |
Don't wrap parameters if key already exists
We shouldn't perform parameter wrapping if it would overwrite one of the
parameters sent with the request, as that would interfere with reading
the parameter directly from the top level `params` hash.
The current implementation has logic for this case, but it doesn't
handle `nil`/`false` values, which means these parameters:
{ "user" => nil }
are transformed into this `params` hash:
{ "user" => { "user" => nil } }
and `params["user"]` no longer returns the original parameter value.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/params_wrapper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/params_wrapper.rb b/actionpack/lib/action_controller/metal/params_wrapper.rb index 68881b8402..44151c9f71 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -282,7 +282,7 @@ module ActionController return false unless request.has_content_type? ref = request.content_mime_type.ref - _wrapper_formats.include?(ref) && _wrapper_key && !request.request_parameters[_wrapper_key] + _wrapper_formats.include?(ref) && _wrapper_key && !request.request_parameters.key?(_wrapper_key) end end end |