Skip to content

Commit

Permalink
Fix Mime::Type#=~ not using Regexp.quote
Browse files Browse the repository at this point in the history
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information
fcheung authored and lifo committed Dec 21, 2008
1 parent 75a133f commit 606cd61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/mime_type.rb
Expand Up @@ -178,7 +178,7 @@ def ==(mime_type)

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
Expand Down
1 change: 1 addition & 0 deletions actionpack/test/controller/mime_type_test.rb
Expand Up @@ -88,5 +88,6 @@ def test_regexp_matcher
assert Mime::JS !~ "text/html"
assert !(Mime::JS !~ "text/javascript")
assert !(Mime::JS !~ "application/javascript")
assert Mime::HTML =~ 'application/xhtml+xml'
end
end

0 comments on commit 606cd61

Please sign in to comment.