Commit e5ed0191 by Prem Sichanugrist

Also make sure that file is rewinded in filestore

parent 95d7c4a1
...@@ -36,6 +36,7 @@ module Paperclip ...@@ -36,6 +36,7 @@ module Paperclip
end end
end end
FileUtils.chmod(0666&~File.umask, path(style_name)) FileUtils.chmod(0666&~File.umask, path(style_name))
file.rewind
end end
after_flush_writes # allows attachment to clean up temp files after_flush_writes # allows attachment to clean up temp files
......
...@@ -26,6 +26,12 @@ class FileSystemTest < Test::Unit::TestCase ...@@ -26,6 +26,12 @@ class FileSystemTest < Test::Unit::TestCase
@dummy.save @dummy.save
assert_file_exists(@dummy.avatar.path(:thumbnail)) assert_file_exists(@dummy.avatar.path(:thumbnail))
end end
should "be rewinded after flush_writes" do
files = @dummy.avatar.queued_for_write.map{ |style, file| file }
@dummy.save
assert files.none?(&:eof?), "Expect all the files to be rewinded."
end
end end
context "with file that has space in file name" do context "with file that has space in file name" do
......
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