Skip to content

iOS HEIC images don't work #208

@phette23

Description

@phette23

Package version (if known): 2.2.1 and all prior

Describe the bug

Apple's iOS devices save HEIC images with misleading .jpg extensions which tricks previewer into thinking that it can preview them but (almost all) web browsers cannot render these images.

Steps to Reproduce

  1. Create a record with all required fields
  2. Attach a HEIC image with a .jpeg extension
  3. Publish the record

Expected behavior

HEIC images should be skipped, treated like other image formats that are not previewed, such as WebP. Instead, previewer thinks it can use the simple_image previewer, but the image does not render in the img tag because browser rendering engines cannot display HEIC.

Screenshots (if applicable)

invenio previewer heic error

Additional context

I think the solution would involve using some kind of file type detection library (filetype, puremagic) which looks at the bytes of the image file to determine whether they can be previewed instead of relying upon their extension. This would have a bonus effect of fixing previews of files with misleading extensions (e.g. plain text file with .png extension).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions