提交 606cd61b 编写于 作者: F Frederick Cheung 提交者: Pratik Naik

Fix Mime::Type#=~ not using Regexp.quote

Signed-off-by: NPratik Naik <pratiknaik@gmail.com>
上级 75a133f9
......@@ -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
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册