Permalink
Browse files

Merge pull request #12619 from Veraticus/fix_utils_normalize_path

Correct error in Utils.normalize_path that changed paths improperly
  • Loading branch information...
1 parent b7a495a commit dece3408fa04e0eab4c1b0313a6d688a2192915f @rafaelfranca rafaelfranca committed Oct 23, 2013
@@ -18,7 +18,7 @@ def self.normalize_path(path)
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
@@ -15,6 +15,14 @@ def test_fragment_escape
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

0 comments on commit dece340

Please sign in to comment.