Skip to content

A platform for community discussion. Free, open, simple.

FIX: raise an exception when 'downsize'git st fails

Régis Hanol98898ff4b327
diff --git a/lib/upload_creator.rb b/lib/upload_creator.rb
index 10b5902a001..f3c0bcd9f22 100644
--- a/lib/upload_creator.rb
+++ b/lib/upload_creator.rb
@@ -187,8 +187,18 @@ class UploadCreator
3.times do
original_size = filesize
downsized_pixels = [pixels, max_image_pixels].min / 2
- OptimizedImage.downsize(@file.path, @file.path, "#{downsized_pixels}@", filename: @filename, allow_animation: allow_animation)
+
+ OptimizedImage.downsize(
+ @file.path,
+ @file.path,
+ "#{downsized_pixels}@",
+ filename: @filename,
+ allow_animation: allow_animation,
+ raise_on_error: true
+ )
+
extract_image_info!
+
return if filesize >= original_size || pixels == 0 || !should_downsize?
end
end