Commit b48cea76 by Jon Yurek

binmode and Tempfile fixes for windows

parent d92be0d8
......@@ -67,6 +67,7 @@ module Paperclip
return nil unless valid_assignment?(uploaded_file)
logger.info("[paperclip] Assigning #{uploaded_file.inspect} to #{name}")
uploaded_file.binmode if uploaded_file.respond_to? :binmode
queue_existing_for_delete
@errors = []
@validation_errors = nil
......
......@@ -41,3 +41,18 @@ end
end
end
end
# Corrects a bug in Windows when asking for Tempfile size.
if defined? Tempfile
class Tempfile
def size
if @tmpfile
@tmpfile.fsync
@tmpfile.flush
@tmpfile.stat.size
else
0
end
end
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