Skip to content
This repository

3 2 static invalid byte sequence #5338

Merged
merged 1 commit into from about 2 years ago

2 participants

Michael Reinsch Aaron Patterson
Michael Reinsch

#5337 for 3-2-stable

Aaron Patterson tenderlove merged commit f918137 into from March 15, 2012
Aaron Patterson tenderlove closed this March 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 08, 2012
Michael Reinsch fix ArgumentError being raised in case of invalid byte sequences 55cac81
This page is out of date. Refresh to see the latest.
1  actionpack/lib/action_dispatch/middleware/static.rb
@@ -38,6 +38,7 @@ def unescape_path(path)
38 38
     end
39 39
 
40 40
     def escape_glob_chars(path)
  41
+      path.force_encoding('binary') if path.respond_to? :force_encoding
41 42
       path.gsub(/[*?{}\[\]]/, "\\\\\\&")
42 43
     end
43 44
   end
4  actionpack/test/dispatch/static_test.rb
@@ -6,6 +6,10 @@ def test_serves_dynamic_content
6 6
     assert_equal "Hello, World!", get("/nofile").body
7 7
   end
8 8
 
  9
+  def test_handles_urls_with_bad_encoding
  10
+    assert_equal "Hello, World!", get("/doorkeeper%E3E4").body
  11
+  end
  12
+
9 13
   def test_sets_cache_control
10 14
     response = get("/index.html")
11 15
     assert_html "/index.html", response
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.