Permalink
Browse files

Merge pull request #5337 from mreinsch/static_invalid_byte_sequence

fix ArgumentError being raised in case of invalid byte sequences
  • Loading branch information...
2 parents ee8e567 + 7d5fbf8 commit 8f5f92cf8e96314e96ce38a6c60c64a40c27ae49 @tenderlove tenderlove committed Mar 15, 2012
Showing with 5 additions and 0 deletions.
  1. +1 −0 actionpack/lib/action_dispatch/middleware/static.rb
  2. +4 −0 actionpack/test/dispatch/static_test.rb
@@ -39,6 +39,7 @@ def unescape_path(path)
end
def escape_glob_chars(path)
+ path.force_encoding('binary') if path.respond_to? :force_encoding
path.gsub(/[*?{}\[\]]/, "\\\\\\&")
end
end
@@ -7,6 +7,10 @@ def test_serves_dynamic_content
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

0 comments on commit 8f5f92c

Please sign in to comment.