From 523c56f60b051f8b5ab94a95173810d1888e6f76 Mon Sep 17 00:00:00 2001 From: Eric Leroy-Terquem Date: Thu, 7 Nov 2024 12:05:04 +0100 Subject: [PATCH] fix(image processing): catch minimagick error caused by png path --- app/services/uninterlace_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/services/uninterlace_service.rb b/app/services/uninterlace_service.rb index 0ec100e38..72b51b63e 100644 --- a/app/services/uninterlace_service.rb +++ b/app/services/uninterlace_service.rb @@ -18,7 +18,11 @@ class UninterlaceService def interlaced?(png_path) return false if png_path.blank? - png = MiniMagick::Image.open(png_path) + begin + png = MiniMagick::Image.open(png_path) + rescue MiniMagick::Invalid + return false + end png.data["interlace"] != "None" end end