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
- Update expectation for
<img srcto become a browser-resolvable URL - 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">.
Issue fork experience_builder-3543783
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
Comment #3
wim leersComment #6
wim leersComment #8
wim leersYay, last blocker to #3530351: Decouple image+video (URI) shape matching from specific image+video file types/extensions is in! 🚀
Comment #9
wim leersI think @justafish accidentally posted their review on the wrong MR: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1... 🤠
Comment #10
justafishI did 🥴