FIX: only call 'unlink' for tempfiles

This commit is contained in:
Régis Hanol 2019-03-08 11:22:20 +01:00 committed by GitHub
parent 7ff994b6ea
commit ad12b2a23d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -407,8 +407,8 @@ class OptimizedImage < ActiveRecord::Base
# just ditch the optimized image if there was any errors
optimized_image.destroy
ensure
file&.unlink
file&.close
file&.unlink if file&.respond_to?(:unlink)
end
end
end