From ffc0ddc446775bde5702a5932fa500dd75941340 Mon Sep 17 00:00:00 2001 From: Eric Leroy-Terquem Date: Wed, 29 May 2024 11:15:40 +0200 Subject: [PATCH] chore(gallery): add activestorage error catching in front --- app/helpers/gallery_helper.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/helpers/gallery_helper.rb b/app/helpers/gallery_helper.rb index 67068d480..98f7ffc1e 100644 --- a/app/helpers/gallery_helper.rb +++ b/app/helpers/gallery_helper.rb @@ -9,13 +9,19 @@ module GalleryHelper def preview_url_for(attachment) attachment.preview(resize_to_limit: [400, 400]).processed.url + rescue ActiveStorage::Error + 'pdf-placeholder.png' end def variant_url_for(attachment) attachment.variant(resize_to_limit: [400, 400]).processed.url + rescue ActiveStorage::Error + 'apercu-indisponible.png' end def blob_url(attachment) attachment.blob.content_type.in?(RARE_IMAGE_TYPES) ? attachment.variant(resize_to_limit: [2000, 2000]).processed.url : attachment.blob.url + rescue ActiveStorage::Error + attachment.blob.url end end