Commit 1c1e37f2 by Rob Cherry

Add support for returning all possible mime types by magic.

parent 99290c4a
......@@ -107,7 +107,7 @@ class MimeMagic
end
def self.magic_match(io, method)
mime_or_mimes = if io.respond_to?(:seek) && io.respond_to?(:read)
if io.respond_to?(:seek) && io.respond_to?(:read)
io.binmode
io.set_encoding(Encoding::BINARY) if io.respond_to?(:set_encoding)
MAGIC.send(method) { |type, matches| magic_match_io(io, matches) }
......@@ -116,7 +116,6 @@ class MimeMagic
str = str.force_encoding(Encoding::BINARY) if str.respond_to?(:force_encoding)
MAGIC.send(method) { |type, matches| magic_match_str(str, matches) }
end
method == :find ? [mime_or_mimes] : mime_or_mimes
end
def self.magic_match_io(io, matches)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment