`card-with-stream-wrapper-image` test SDC generates an invalid `<img src>`

Created on 29 August 2025, 2 days ago

Overview

Discovered in šŸ“Œ Decouple image (URI) shape matching from specific image file types/extensions Active , specifically this MR thread. This bug makes that MR harder to understand.

šŸ“Œ Create an Image SDC that can be included by other SDCs Active introduced a noUi: true experience_builder:image SDC, that was intended to be broadly usable by other SDC developers to simply generate responsive images. So broadly, even, that Drupal-uploaded files (public://cat.jpg, for example) should work, too. (That's covered by the xb_test_sdc:card-with-stream-wrapper-image SDC that was added there, which reuses the xb_test_sdc:card SDC, which in turn reuses the experience_builder:image SDC.)

However, it does NOT work, and we even have it explicitly in our test expectations:

  <img
   class="card--image"
   src="public://balloons.png"

šŸ™ˆ

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

  1. Update expectation for <img src to become a browser-resolvable URL
  2. Update logic to generate such a URL

User interface changes

Browsers without support for srcset that get served component instances using the above functionality will now get an image that actually loads, instead of something like <img src="public://fish.jpg">.

šŸ› Bug report
Status

Active

Version

1.0

Component

Component sources

Created by

šŸ‡§šŸ‡ŖBelgium wim leers Ghent šŸ‡§šŸ‡ŖšŸ‡ŖšŸ‡ŗ

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024