Skip to content

Commit

Permalink
fix ArgumentError being raised in case of invalid byte sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reinsch committed Mar 8, 2012
1 parent efc0d03 commit 7d5fbf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions actionpack/lib/action_dispatch/middleware/static.rb
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions actionpack/test/dispatch/static_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 7d5fbf8

Please sign in to comment.