Commit ea922128 by Jon Yurek

Don't use --mime-type

The `file` command on OS X takes the --mime-type option, which returns
only the type and not the optional encoding. This is nice, but it's not
portable. Use --mime and strip the encoding off if it's there.

And don't forget this time.
parent ae89f79d
...@@ -52,7 +52,7 @@ module Paperclip ...@@ -52,7 +52,7 @@ module Paperclip
def type_from_file_command def type_from_file_command
begin begin
Paperclip.run("file", "-b --mime-type :file", :file => @file.path) Paperclip.run("file", "-b --mime :file", :file => @file.path).split(/[:;]\s+/).first
rescue Cocaine::CommandLineError rescue Cocaine::CommandLineError
"" ""
end end
......
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