mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 06:34:41 +08: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:
@ -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
|
||||
|
Reference in New Issue
Block a user