Overview

Discovered in #3530351: Decouple image+video (URI) shape matching from specific image+video file types/extensions, specifically this MR thread. This bug makes that MR harder to understand.

#3535453: Create an Image SDC that can be included by other SDCs 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 #3530351: Decouple image+video (URI) shape matching from specific image+video file types/extensions 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">.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

wim leers created an issue. See original summary.

wim leers’s picture

Assigned: wim leers » justafish
Status: Active » Needs review

wim leers’s picture

Assigned: justafish » Unassigned
Status: Needs review » Reviewed & tested by the community

  • wim leers committed 5df127b4 on 1.x
    Issue #3543783 by wim leers, justafish, penyaskito: `card-with-stream-...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed
wim leers’s picture

I think @justafish accidentally posted their review on the wrong MR: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1... 🤠

justafish’s picture

I did 🥴

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.