aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2015-06-16 21:03:39 +0200
committerArthur Neves <arthurnn@gmail.com>2015-06-16 23:27:49 +0200
commite23b3149458b22cf07382d6aeb2264585e28a339 (patch)
treeebb3f70d250693dcd4423c492de453fa629ac01e /actionpack/test
parente60c18931c81a88f4eb89059e955d6ff07c5e26c (diff)
downloadrails-e23b3149458b22cf07382d6aeb2264585e28a339.tar.gz
rails-e23b3149458b22cf07382d6aeb2264585e28a339.tar.bz2
rails-e23b3149458b22cf07382d6aeb2264585e28a339.zip
Catch InvalidURIError on bad paths on redirect.
Handle URI::InvalidURIError errors on the redirect route method, so it wont raise a 500 if a bad path is given.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/journey/router_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/journey/router_test.rb b/actionpack/test/journey/router_test.rb
index 802fb93c69..c4bffa2f15 100644
--- a/actionpack/test/journey/router_test.rb
+++ b/actionpack/test/journey/router_test.rb
@@ -219,6 +219,13 @@ module ActionDispatch
assert_equal 404, resp.first
end
+ def test_invalid_url_path
+ routes = Class.new { include ActionDispatch::Routing::Redirection }.new
+ route = routes.redirect("/foo/bar/%{id}")
+ resp = route.serve(rails_env({ 'REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/foo/(function(){})' }))
+ assert_equal 400, resp.first
+ end
+
def test_clear_trailing_slash_from_script_name_on_root_unanchored_routes
route_set = Routing::RouteSet.new
mapper = Routing::Mapper.new route_set