diff options
author | Tobias Lütke <tobi@jadedpixel.com> | 2008-05-01 17:45:14 -0400 |
---|---|---|
committer | Tobias Lütke <tobi@jadedpixel.com> | 2008-05-01 17:45:14 -0400 |
commit | f48e89931f3dfe0571f62f926c01cb7783814347 (patch) | |
tree | 7c6150a8cceb84307f152664fb73d7149c9c51f3 /actionpack/lib/action_controller | |
parent | f122ca58745f6218cb531fb683b97686254fea5d (diff) | |
download | rails-f48e89931f3dfe0571f62f926c01cb7783814347.tar.gz rails-f48e89931f3dfe0571f62f926c01cb7783814347.tar.bz2 rails-f48e89931f3dfe0571f62f926c01cb7783814347.zip |
Accept header mime parser can now deal with empty fields
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/mime_type.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/mime_type.rb b/actionpack/lib/action_controller/mime_type.rb index 16e3ffc9c1..8c02f20521 100644 --- a/actionpack/lib/action_controller/mime_type.rb +++ b/actionpack/lib/action_controller/mime_type.rb @@ -71,8 +71,11 @@ module Mime # keep track of creation order to keep the subsequent sort stable list = [] accept_header.split(/,/).each_with_index do |header, index| - params = header.split(/;\s*q=/) - list << AcceptItem.new(index, *params) unless params.empty? + params, q = header.split(/;\s*q=/) + if params + params.strip! + list << AcceptItem.new(index, params, q) unless params.empty? + end end list.sort! @@ -145,7 +148,7 @@ module Mime end def ==(mime_type) - return false unless mime_type + return false if mime_type.blank? (@synonyms + [ self ]).any? do |synonym| synonym.to_s == mime_type.to_s || synonym.to_sym == mime_type.to_sym end |