diff options
author | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2014-02-13 18:05:55 +0100 |
---|---|---|
committer | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2014-02-13 18:05:55 +0100 |
commit | 00a4af9ab7e2008fe4e1a0cb1f31109a231d7279 (patch) | |
tree | 69e72dc8168a55108b133506c51696cfa1466810 /actionpack/lib/action_dispatch | |
parent | f2dfa83fac5e892335d2bceaa6dfe344515fee26 (diff) | |
download | rails-00a4af9ab7e2008fe4e1a0cb1f31109a231d7279.tar.gz rails-00a4af9ab7e2008fe4e1a0cb1f31109a231d7279.tar.bz2 rails-00a4af9ab7e2008fe4e1a0cb1f31109a231d7279.zip |
Check if variant array contains only symbols
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/mime_negotiation.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_negotiation.rb b/actionpack/lib/action_dispatch/http/mime_negotiation.rb index b75d7ffe9d..b803ce8b6f 100644 --- a/actionpack/lib/action_dispatch/http/mime_negotiation.rb +++ b/actionpack/lib/action_dispatch/http/mime_negotiation.rb @@ -70,10 +70,10 @@ module ActionDispatch def variant=(variant) if variant.is_a?(Symbol) @variant = [variant] - elsif variant.is_a?(Array) + elsif variant.is_a?(Array) && variant.any? && variant.all?{ |v| v.is_a?(Symbol) } @variant = variant else - raise ArgumentError, "request.variant must be set to a Symbol or Array, not a #{variant.class}. " \ + raise ArgumentError, "request.variant must be set to a Symbol or an Array of Symbols, not a #{variant.class}. " \ "For security reasons, never directly set the variant to a user-provided value, " \ "like params[:variant].to_sym. Check user-provided value against a whitelist first, " \ "then set the variant: request.variant = :tablet if params[:variant] == 'tablet'" |