mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Correct error in Utils.normalize_path that changed paths improperly
This commit is contained in:
parent
ec3ad30606
commit
cb81a535e0
2 changed files with 9 additions and 1 deletions
|
@ -18,7 +18,7 @@ module ActionDispatch
|
||||||
path = "/#{path}"
|
path = "/#{path}"
|
||||||
path.squeeze!('/')
|
path.squeeze!('/')
|
||||||
path.sub!(%r{/+\Z}, '')
|
path.sub!(%r{/+\Z}, '')
|
||||||
path.gsub!(/(%[a-f0-9]{2}+)/) { $1.upcase }
|
path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
|
||||||
path = '/' if path == ''
|
path = '/' if path == ''
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,14 @@ module ActionDispatch
|
||||||
def test_uri_unescape
|
def test_uri_unescape
|
||||||
assert_equal "a/b c+d", Utils.unescape_uri("a%2Fb%20c+d")
|
assert_equal "a/b c+d", Utils.unescape_uri("a%2Fb%20c+d")
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue