diff options
-rw-r--r-- | actionpack/lib/action_controller/mime_type.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/mime_type_test.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/mime_type.rb b/actionpack/lib/action_controller/mime_type.rb index 43b3da8d35..017626ba27 100644 --- a/actionpack/lib/action_controller/mime_type.rb +++ b/actionpack/lib/action_controller/mime_type.rb @@ -178,7 +178,7 @@ module Mime def =~(mime_type) return false if mime_type.blank? - regexp = Regexp.new(mime_type.to_s) + regexp = Regexp.new(Regexp.quote(mime_type.to_s)) (@synonyms + [ self ]).any? do |synonym| synonym.to_s =~ regexp end diff --git a/actionpack/test/controller/mime_type_test.rb b/actionpack/test/controller/mime_type_test.rb index 9c4416ecf0..c7faa621d9 100644 --- a/actionpack/test/controller/mime_type_test.rb +++ b/actionpack/test/controller/mime_type_test.rb @@ -88,5 +88,6 @@ class MimeTypeTest < Test::Unit::TestCase assert Mime::JS !~ "text/html" assert !(Mime::JS !~ "text/javascript") assert !(Mime::JS !~ "application/javascript") + assert Mime::HTML =~ 'application/xhtml+xml' end end |