Skip to content

Commit

Permalink
fix(gallery): catch StandardError
Browse files Browse the repository at this point in the history
  • Loading branch information
E-L-T committed Jun 10, 2024
1 parent fe0619a commit 4e35018
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/helpers/gallery_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ def displayable_image?(blob)

def preview_url_for(attachment)
attachment.preview(resize_to_limit: [400, 400]).processed.url
rescue ActiveStorage::Error
rescue StandardError
'pdf-placeholder.png'
end

def variant_url_for(attachment)
attachment.variant(resize_to_limit: [400, 400]).processed.url
rescue ActiveStorage::Error
attachment.variant(resize_to_limit: [400, 400])

Check warning on line 17 in app/helpers/gallery_helper.rb

View check run for this annotation

Codecov / codecov/patch

app/helpers/gallery_helper.rb#L17

Added line #L17 was not covered by tests
rescue StandardError
'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
rescue StandardError
attachment.blob.url
end
end

0 comments on commit 4e35018

Please sign in to comment.