mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
FIX: destroy optimized images that cant' be migrated to new scheme
Since we can always recompute an optimized image from the original upload, there's no need to keep optimized images that are generating errors.
This commit is contained in:
parent
fb8ba5e137
commit
87ab1cef8e
1 changed files with 2 additions and 0 deletions
|
@ -220,6 +220,8 @@ class OptimizedImage < ActiveRecord::Base
|
|||
end
|
||||
rescue => e
|
||||
problems << { optimized_image: optimized_image, ex: e }
|
||||
# just ditch the optimized image if there was any errors
|
||||
optimized_image.destroy
|
||||
ensure
|
||||
file.try(:unlink) rescue nil
|
||||
file.try(:close) rescue nil
|
||||
|
|
Loading…
Reference in a new issue