mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
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>
9 lines
470 B
Ruby
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
|