fix ArgumentError being raised in case of invalid byte sequences

This commit is contained in:
Michael Reinsch
2012-03-08 20:26:10 +09:00
parent 9bcd6622dd
commit 55cac81bc5
2 changed files with 5 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ module ActionDispatch
end
def escape_glob_chars(path)
path.force_encoding('binary') if path.respond_to? :force_encoding
path.gsub(/[*?{}\[\]]/, "\\\\\\&")
end
end

View File

@@ -6,6 +6,10 @@ module StaticTests
assert_equal "Hello, World!", get("/nofile").body
end
def test_handles_urls_with_bad_encoding
assert_equal "Hello, World!", get("/doorkeeper%E3E4").body
end
def test_sets_cache_control
response = get("/index.html")
assert_html "/index.html", response