Files
rickyandClaude Opus 5.5 a2672b99a3 Restore thumbnails for photos recorded without dimensions
Photos uploaded before image processing was installed are marked analyzed
with no width, so the "unreadable image" check showed them as file links.
Every resizable image gets a thumbnail again; one that can't be read still
falls back to the original when resizing fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 13:26:28 -05:00

9 lines
470 B
Ruby

# Uploads that claim to be images but can't be read as one (empty, corrupt,
# or another kind of file with an image name): if resizing fails, send the
# original rather than an error.
Rails.application.config.to_prepare do
ActiveStorage::Representations::BaseController.rescue_from(Vips::Error, ActiveStorage::InvariableError) do
redirect_to Rails.application.routes.url_helpers.rails_blob_path(@blob, disposition: params[:disposition], only_path: true)
end
end