1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #5337 from mreinsch/static_invalid_byte_sequence

fix ArgumentError being raised in case of invalid byte sequences
This commit is contained in:
Aaron Patterson 2012-03-15 10:14:01 -07:00
commit 8f5f92cf8e
2 changed files with 5 additions and 0 deletions

View file

@ -39,6 +39,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

@ -7,6 +7,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