AVIF sometimes generates 0 byte files, persists to file system and/or cache

Created on 11 October 2023, about 1 year ago
Updated 11 November 2023, about 1 year ago

Problem/Motivation

Occasionally this module is unable to generate an AVIF derivative. In some cases this leads to a zero-byte file being saved to the file system, which will continue to be served on following requests. In other cases no file is written to disk but served to the browser and potentially cached for a very long time.

Steps to reproduce

TBD

Proposed resolution

  1. Add checks in \Drupal\avif\Plugin\AvifProcessorInterface::convert implementations that \Drupal\Core\Image\ImageInterface::apply actually returned TRUE before calling \Drupal\Core\Image\ImageInterface::save
  2. Add checks in \Drupal\avif\Controller\ImageStyleDownloadController::deliver for a non-zero filesize before returning a BinaryFileResponse
  3. Return a 500 instead of a 404 if the derivative could not be generated, as per \Drupal\image\Controller\ImageStyleDownloadController::deliver

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇺Australia mstrelan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024