Fatal error when image module is not turned on

Created on 9 December 2024, 10 days ago

Problem/Motivation

When the image module is not turned on a fatal error occurs when trying to download JS and CSS files. Resulting in for example a website without styling. Aggregation needs to be turned on as well for JS and CSS.

The error:
Error: Class "Drupal\image\Controller\ImageStyleDownloadController" not found in Drupal\stage_file_proxy\EventSubscriber\StageFileProxySubscriber->checkFileOrigin() (line 123 in .....)
Which points to:

$unconverted_path = substr(ImageStyleDownloadController::getUriWithoutConvertedExtension('public://' . $relative_path), strlen('public://'));

Steps to reproduce

Install stage file proxy module 3.1.4
Don't turn on the image module.
Turn on aggregation.
Turn on page_cache
Turn on big_pipe

Proposed resolution

  1. Adjust the code in the event subscriber to only be used when the image module is turned on
  2. Make the image module a dependency

This is kind of a niche issue, since the image module is probably turned on 99% of the time. But you know what they say about assumptions.....

πŸ› Bug report
Status

Active

Version

3.1

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands mike.vindicate

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

Comments & Activities

Production build 0.71.5 2024