You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
transformers.image.magick fails a .jfif upload with MiniMagick::Error "unable to open image 'jfif:...'" #84
transformers.image.magick fails to transform a JPEG uploaded as .jfif, .jfi or .jif, and the failure is permanent. The Vips transformer and stock Rails are unaffected. The bug started with #82, which moved hotcell to image_processing 2.2.0.
Error
The application gets HotCell::PermanentFailure, or the cell's configured permanent: class, with this message:
unreadable: MiniMagick::Error: `magick /dev/fd/7[0] -auto-orient jfif:/tmp/…/output-0` failed with status: 1 and error:
magick: unable to open image 'jfif:/tmp/…/output-0': No such file or directory @ error/blob.c/OpenBlob/3638.
Cause
For a web image, Rails uses the upload's extension as the variant format when Marcel maps that extension to the blob's content type (representable.rb#L172-L185). So a photo.jfif upload with content type image/jpeg gets format jfif.
The transform operation saves to the output's scratch path, which has no extension (transforming.rb#L18). For a destination like that, image_processing 2.2.0 (janko/image_processing#150) names the format as an ImageMagick prefix, jfif:/path (mini_magick.rb#L87).
ImageMagick has no coder named JFIF, so it reads jfif:/path as a filename rather than a format and a path. Opening that filename fails.
Before #82, the operation saved to output-0.jfif. ImageMagick ignored the extension it did not recognise, wrote the source's format, JPEG, and the variant rendered.
The formats jpg, jpeg, jpe, png, gif and webp work in any letter case. An explicit svgz variant fails on the same path. Stock Rails calls image_processing without a destination, so image_processing names its own tempfile with the extension, and this failure does not occur there.
Reproduce
Add this to activestorage-hotcell-server/test/magick_transform_image_test.rb. It passes on 6c775e26, the commit before #82, and fails on 1ff4726f with the error above.
In hotcell, have the ImageMagick toolchain save to destination.path(extension: format) and adopt it, as it did before Require image_processing 2.2.0 and drop the transform rename #82. ImageMagick then chooses the format by extension, as it does under stock Rails. The Vips toolchain keeps saving to the scratch path directly.
In image_processing, have the MiniMagick saver fall back to the unprefixed path when ImageMagick does not recognise the format.
Activity
flavorjones commentedon Sep 30, 2026
Since I don't have this problem currently (personally) I'm waiting to see if it's actually a problem. Please post a comment if you run into this.