From cb81a535e0ea7de890a7d65982364c4e7c6ba254 Mon Sep 17 00:00:00 2001
From: Josh Symonds <veraticus@gmail.com>
Date: Wed, 23 Oct 2013 16:44:23 -0500
Subject: Correct error in Utils.normalize_path that changed paths improperly

---
 actionpack/lib/action_dispatch/journey/router/utils.rb | 2 +-
 actionpack/test/journey/router/utils_test.rb           | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

(limited to 'actionpack')

diff --git a/actionpack/lib/action_dispatch/journey/router/utils.rb b/actionpack/lib/action_dispatch/journey/router/utils.rb
index 1edf86cd88..d1a004af50 100644
--- a/actionpack/lib/action_dispatch/journey/router/utils.rb
+++ b/actionpack/lib/action_dispatch/journey/router/utils.rb
@@ -18,7 +18,7 @@ module ActionDispatch
           path = "/#{path}"
           path.squeeze!('/')
           path.sub!(%r{/+\Z}, '')
-          path.gsub!(/(%[a-f0-9]{2}+)/) { $1.upcase }
+          path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
           path = '/' if path == ''
           path
         end
diff --git a/actionpack/test/journey/router/utils_test.rb b/actionpack/test/journey/router/utils_test.rb
index 057dc40cca..93348f4647 100644
--- a/actionpack/test/journey/router/utils_test.rb
+++ b/actionpack/test/journey/router/utils_test.rb
@@ -15,6 +15,14 @@ module ActionDispatch
         def test_uri_unescape
           assert_equal "a/b c+d", Utils.unescape_uri("a%2Fb%20c+d")
         end
+
+        def test_normalize_path_not_greedy
+          assert_equal "/foo%20bar%20baz", Utils.normalize_path("/foo%20bar%20baz")
+        end
+
+        def test_normalize_path_uppercase
+          assert_equal "/foo%AAbar%AAbaz", Utils.normalize_path("/foo%aabar%aabaz")
+        end
       end
     end
   end
-- 
cgit v1.2.3