提交 783527fd 编写于 作者: R Rafael Mendonça França

Merge pull request #12619 from Veraticus/fix_utils_normalize_path

Correct error in Utils.normalize_path that changed paths improperly
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册