]> git.openstreetmap.org Git - rails.git/commitdiff
Drop monkey patch now we're using option style redirects
authorTom Hughes <tom@compton.nu>
Sun, 1 Dec 2013 20:54:52 +0000 (20:54 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 1 Dec 2013 20:54:52 +0000 (20:54 +0000)
Option style redirects escape path parameters correctly, so we
can drop out monkey patch.

config/initializers/routing_redirect.rb [deleted file]
test/integration/redirect_test.rb

diff --git a/config/initializers/routing_redirect.rb b/config/initializers/routing_redirect.rb
deleted file mode 100644 (file)
index d064472..0000000
+++ /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
index 5a9ba17ec4276a55b069e4183058df84fd920f6b..1c4af7d4fe81752888294b9218519c1227744d63 100644 (file)
@@ -31,6 +31,10 @@ class RedirectTest  < ActionDispatch::IntegrationTest
     get "/user/name/edits"
     assert_response :redirect
     assert_redirected_to "/user/name/history"
     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
   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/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
   end
 
   def test_browse_redirects