From aff0583a341b473e8c25f605fdddfa55fd275a64 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 1 Dec 2013 20:54:52 +0000 Subject: [PATCH 1/1] Drop monkey patch now we're using option style redirects Option style redirects escape path parameters correctly, so we can drop out monkey patch. --- config/initializers/routing_redirect.rb | 16 ---------------- test/integration/redirect_test.rb | 8 ++++++++ 2 files changed, 8 insertions(+), 16 deletions(-) delete mode 100644 config/initializers/routing_redirect.rb diff --git a/config/initializers/routing_redirect.rb b/config/initializers/routing_redirect.rb deleted file mode 100644 index d064472f6..000000000 --- a/config/initializers/routing_redirect.rb +++ /dev/null @@ -1,16 +0,0 @@ -require "action_dispatch/routing/redirection" - -# -# Fix escaping in routes to use path style escaping -# -# https://github.com/rails/rails/issues/13110 -# -module ActionDispatch - module Routing - class PathRedirect < Redirect - def escape(params) - Hash[params.map{ |k,v| [k, URI.escape(v)] }] - end - end - end -end diff --git a/test/integration/redirect_test.rb b/test/integration/redirect_test.rb index 5a9ba17ec..1c4af7d4f 100644 --- a/test/integration/redirect_test.rb +++ b/test/integration/redirect_test.rb @@ -31,6 +31,10 @@ class RedirectTest < ActionDispatch::IntegrationTest get "/user/name/edits" assert_response :redirect assert_redirected_to "/user/name/history" + + get "/user/name%20with%20spaces/edits" + assert_response :redirect + assert_redirected_to "/user/name%20with%20spaces/history" end def test_history_feed_redirects @@ -45,6 +49,10 @@ class RedirectTest < ActionDispatch::IntegrationTest get "/user/name/edits/feed" assert_response :redirect assert_redirected_to "/user/name/history/feed" + + get "/user/name%20with%20spaces/edits/feed" + assert_response :redirect + assert_redirected_to "/user/name%20with%20spaces/history/feed" end def test_browse_redirects -- 2.39.5