aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/parameters.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2016-07-14 10:40:58 -0700
committerGitHub <noreply@github.com>2016-07-14 10:40:58 -0700
commitb866be168049ea96444087046f4fca7bd64d618b (patch)
tree0bfaa2eeb07129d446ff8441ab9d4354806e7391 /actionpack/lib/action_dispatch/http/parameters.rb
parentea31bdd7c8b1221d97de2392ac22d9c5fb8657d5 (diff)
parent9f38a3fb0c9c71102da283b014503ccad92da581 (diff)
downloadrails-b866be168049ea96444087046f4fca7bd64d618b.tar.gz
rails-b866be168049ea96444087046f4fca7bd64d618b.tar.bz2
rails-b866be168049ea96444087046f4fca7bd64d618b.zip
Merge pull request #25816 from greysteil/check-path-param-encoding
Check `request.path_parameters` encoding at the point they're set
Diffstat (limited to 'actionpack/lib/action_dispatch/http/parameters.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/parameters.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb
index ff5031d7d5..3f0e51790c 100644
--- a/actionpack/lib/action_dispatch/http/parameters.rb
+++ b/actionpack/lib/action_dispatch/http/parameters.rb
@@ -44,7 +44,14 @@ module ActionDispatch
def path_parameters=(parameters) #:nodoc:
delete_header('action_dispatch.request.parameters')
+
+ # If any of the path parameters has an invalid encoding then
+ # raise since it's likely to trigger errors further on.
+ Request::Utils.check_param_encoding(parameters)
+
set_header PARAMETERS_KEY, parameters
+ rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
+ raise ActionController::BadRequest.new("Invalid path parameters: #{e.message}")
end
# Returns a hash with the \parameters used to form the \path of the request.