Handle params key encoding error. #640

Closed
wants to merge 1 commit into
from
View
@@ -36,9 +36,9 @@ def escape_path(s)
module_function :escape_path
# Unescapes a URI escaped string with +encoding+. +encoding+ will be the
- # target encoding of the string returned, and it defaults to UTF-8
+ # target encoding of the string returned, and it defaults to BINARY
if defined?(::Encoding)
- def unescape(s, encoding = Encoding::UTF_8)
+ def unescape(s, encoding = Encoding::BINARY)
URI.decode_www_form_component(s, encoding)
end
else
View
@@ -143,6 +143,8 @@ def kcodeu
should.equal "foo" => "bar"
Rack::Utils.parse_nested_query("foo=\"bar\"").
should.equal "foo" => "\"bar\""
+ lambda { Rack::Utils.parse_nested_query("nonsense%81Ekey=") }.
+ should.not.raise(ArgumentError)
Rack::Utils.parse_nested_query("foo=bar&foo=quux").
should.equal "foo" => "quux"