Skip to content

ActiveStorage::TransformJob doesn't accept previewable files #50005

Closed
@nicowenterodt

Description

@nicowenterodt

Steps to reproduce

When having a predefined variant for an attachment and you're making use of the preprocessed option, the ActiveStorage::TransformJob will fail for previewable files like PDFs with ActiveStorage::InvariableError.

To reproduce simply define a variant for an attachment like this:

has_one_attached :file do |attachable|
    attachable.variant :thumb, resize_to_limit: [400, 600], preprocessed: true
end

After uploading a PDF the ActiveStorage::TransformJob will be enqeued. As soon as the job is being processed it fails with ActiveStorage::InvariableError.

Expected behavior

The ActiveStorage::TransformJob should accept previewable files as well so preprocessed variants are also possible for PDF documents and other previewable filetypes.

Actual behavior

The ActiveStorage::TransformJob fails when a previewable blob is being processed with ActiveStorage::InvariableError

System configuration

Rails version: 7.1.1

Ruby version: 3.2.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions