Resolved image file URLs invalid in kernel tests

Created on 29 August 2025, 18 days ago

Overview

Discovered in 📌 Decouple image (URI) shape matching from specific image file types/extensions Active . This bug makes that MR harder to understand.

In HEAD, any image field instance's values populates a component instance with either its url property or its src_with_alternate_widths property. Both are computed from the value field property. The results are:

  • value = public://test.png
  • url = /vfs://root/sites/simpletest/91669142/files/test.png
  • src_with_alternate_widths = /vfs://root/sites/simpletest/91669142/files/test.png?alternateWidths=/vfs%3A//root/sites/simpletest/91669142/files/styles/xb_parametrized_width--%7Bwidth%7D/public/test.png.webp%3Fitok%3DFEbY0Wjq

🐛 The bug: neither of those latter 2 are valid URLs!

Now, in principle the SDC JSON Schema validation should've complained about that. But due to a bug in the regex (JSON Schema pattern) of json-schema-definitions://experience_builder.module/image-uri, which turns out to have been too broad/liberal in what it accepts. 😬 That's part of what 📌 Decouple image (URI) shape matching from specific image file types/extensions Active is fixing, but in order to keep the scope/MR clear there, this has been lifted out of there.

Proposed resolution

Ensure /vfs://root/sites/simpletest/91669142/files/test.png gets rewritten to a valid URL.

Core has prior art for this: \Drupal\Tests\system\Kernel\Theme\TwigIncludeTest::setUpFilesystem(). Use that.

User interface changes

None.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

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

Comments & Activities

Production build 0.71.5 2024