Commit 2c59f96f by Tute Costa

Automatically close file while checking mime type

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