Raise MiniMagick::Error if ImageMagick is missing delegates needed for image formats #2772
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2732
Starting in Alpine Linux 3.19, installing the
imagemagick
package no longer includes support for JPG, SVG, and other image formats. Additional packages must be installed to support each image format[1].This means upgrading Alpine linux on a server can cause Carrierwave to start failing with
CarrierWave::ProcessingError
when uploading images.The root cause isn't obvious from this error.
However when ImageMagick is not installed, Carrierwave raises
MiniMagick::Error
instead ofCarrierWave::ProcessingError
, and includes the detailed error message.This PR also raises
MiniMagick::Error
if ImageMagick is installed but is missing the delegates required for the image format being manipulated. This will make it easier to debug when uploads are failing.I see there was a previous attempted fix at #2733 and agree that following #2499 we do not want any end-user unfriendly text in
CarrierWave::ProcessingError#message
. As a result I have taken a different approach in this PR.[1] https://maxsmolens.org/posts/imagemagick-packaging-change-on-alpine-linux/