Commit 2c59f96f by Tute Costa

Automatically close file while checking mime type

[fixes #2016]
parent cc874d26
......@@ -67,8 +67,9 @@ module Paperclip
end
def type_from_mime_magic
@type_from_mime_magic ||=
MimeMagic.by_magic(File.open(@filepath)).try(:type)
@type_from_mime_magic ||= File.open(@filepath) do |file|
MimeMagic.by_magic(file).try(:type)
end
end
def type_from_file_command
......
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