Commit 52f87f37 by Joost Baaij

Rescue from permission errors during reprocessing of thumbnails.

In my opinion, a permission error should not result in the entire
reprocessing job being terminated. Especially for large amounts of
files, it's to be expected one or two have various permission issues.

Instead of exiting, now simply print a warning to stderr.
parent 4f85dd44
......@@ -228,6 +228,9 @@ module Paperclip
else
true
end
rescue Errno::EACCES => e
warn "#{e} - skipping file"
false
end
# Returns true if a file has been assigned.
......
......@@ -34,6 +34,22 @@ class IntegrationTest < Test::Unit::TestCase
should "create its thumbnails properly" do
assert_match /\b50x50\b/, `identify "#{@dummy.avatar.path(:thumb)}"`
end
context 'reprocessing with unreadable original' do
setup { File.chmod(0000, @dummy.avatar.path) }
should "not raise an error" do
assert_nothing_raised do
@dummy.avatar.reprocess!
end
end
should "return false" do
assert ! @dummy.avatar.reprocess!
end
teardown { File.chmod(0644, @dummy.avatar.path) }
end
context "redefining its attachment styles" do
setup 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