diff --git a/rack-protection/lib/rack/protection/escaped_params.rb b/rack-protection/lib/rack/protection/escaped_params.rb index d3e79f8a..3283deca 100644 --- a/rack-protection/lib/rack/protection/escaped_params.rb +++ b/rack-protection/lib/rack/protection/escaped_params.rb @@ -66,7 +66,7 @@ module Rack when Hash then escape_hash(object) when Array then object.map { |o| escape(o) } when String then escape_string(object) - else raise ArgumentError, "cannot escape #{object.inspect}" + else nil end end diff --git a/rack-protection/spec/escaped_params_spec.rb b/rack-protection/spec/escaped_params_spec.rb index fc39caca..0bd43dc9 100644 --- a/rack-protection/spec/escaped_params_spec.rb +++ b/rack-protection/spec/escaped_params_spec.rb @@ -30,5 +30,15 @@ describe Rack::Protection::EscapedParams do get '/', :foo => {:bar => ""} body.should == '<bar>' end + + it 'leaves cache-breaker params untouched' do + mock_app do |env| + request = Rack::Request.new(env) + [200, {'Content-Type' => 'text/plain'}, ['hi']] + end + + get '/?95df8d9bf5237ad08df3115ee74dcb10' + body.should == 'hi' + end end end