FIX: raise exception when getting dimensions of missing image

- follow-up on 0eacd45ab1
This commit is contained in:
Penar Musaraj
2018-12-03 10:19:49 -05:00
parent 9125b5fbc4
commit f8e6a37858
4 changed files with 17 additions and 7 deletions

View File

@@ -127,8 +127,12 @@ class Upload < ActiveRecord::Base
Discourse.store.download(self).path
end
self.width, self.height = size = FastImage.new(path).size
self.thumbnail_width, self.thumbnail_height = ImageSizer.resize(*size)
begin
self.width, self.height = size = FastImage.new(path, raise_on_failure: true).size
self.thumbnail_width, self.thumbnail_height = ImageSizer.resize(*size)
rescue => e
Discourse.warn_exception(e, message: "Error getting image dimensions")
end
nil
end