404 error and exception occur when the responsive_image module is disabled.

Created on 21 April 2025, 6 days ago

Problem/Motivation

When accessing the "Image styles usage" report provided by the xray_audit module, a 404 error occurs if the responsive_image module is disabled. Additionally, the following error is logged in the watchdog log:

The "responsive_image_style" entity type does not exist.

This suggests that the module does not correctly check for the existence of the responsive_image entity type before attempting to load it, leading to a fatal error in environments where the module is not enabled.

Steps to reproduce

  1. Ensure the responsive_image module is disabled.
  2. Navigate to: /admin/reports/xray-audit/content-metric/image-styles-usage
  3. Observe the 404 error and check the logs for the missing entity type exception.

Proposed resolution

Update the report builder logic to check if the responsive_image module is enabled before querying or interacting with the responsive_image_style entity type. This can be done using \Drupal::moduleHandler()->moduleExists('responsive_image') and conditionally adjusting the logic accordingly.

Remaining tasks

  • Implement the module existence check in the image style report generator.
  • Add a test to ensure the report does not fail when responsive_image is disabled.

User interface changes

No user interface changes expected.

API changes

No API changes expected.

Data model changes

No data model changes expected.

🐛 Bug report
Status

Active

Version

1.6

Component

Code

Created by

🇪🇸Spain Juanjol Navarra

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

Comments & Activities

Production build 0.71.5 2024