diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-27 14:01:30 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-27 14:01:30 -0700 |
commit | 4797c4caca52b415bc2233254e2503a8e3752c15 (patch) | |
tree | b9e0cde887005839bc54ef0a76897e56d7250666 /actionpack/lib/action_dispatch/http | |
parent | 97a52283f89ae45f967f665e8fc8fd991abb967f (diff) | |
download | rails-4797c4caca52b415bc2233254e2503a8e3752c15.tar.gz rails-4797c4caca52b415bc2233254e2503a8e3752c15.tar.bz2 rails-4797c4caca52b415bc2233254e2503a8e3752c15.zip |
move path_parameter encoding check to the request object
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index cdb3e44b3a..dfe258e463 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -53,6 +53,17 @@ module ActionDispatch @uuid = nil end + def check_path_parameters! + # If any of the path parameters has an invalid encoding then + # raise since it's likely to trigger errors further on. + path_parameters.each do |key, value| + next unless value.respond_to?(:valid_encoding?) + unless value.valid_encoding? + raise ActionController::BadRequest, "Invalid parameter: #{key} => #{value}" + end + end + end + def key?(key) @env.key?(key) end |