Error on validation when file is missing

Created on 17 June 2025, 8 days ago

Problem/Motivation

It happens on local development environments, where most of the time production files are missing (e.g., many projects are using stage_file_proxy module). In such cases, when svg_image_file_validate() is called, we get an error:

Warning: file_get_contents(public://logo/logo.svg): Failed to open stream: "Drupal\Core\StreamWrapper\PublicStream::stream_open" call failed in svg_image_file_validate() (line 143 of /var/www/html/web/modules/contrib/svg_image/svg_image.module).

svg_image_file_validate(Object)
call_user_func_array(Object, Array) (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'svg_image') (Line: 395)
...

Steps to reproduce

  • Node with an SVG field
  • Delete the image from the filsystem
  • Save the node

Proposed resolution

Add a check for file existence.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇷🇴Romania claudiu.cristea Arad 🇷🇴

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

Comments & Activities

Production build 0.71.5 2024