Skip to content

fix: prevent 404 on lightbox bound to multi-image field - #485

Merged
tristan-mouchet merged 1 commit into
developfrom
fix/lightbox-multi-image-cms-404
Aug 3, 2026
Merged

fix: prevent 404 on lightbox bound to multi-image field#485
tristan-mouchet merged 1 commit into
developfrom
fix/lightbox-multi-image-cms-404

Conversation

@tristan-mouchet

Copy link
Copy Markdown
Collaborator

Summary

A dynamic CMS page returned a 404 for the whole page when a Lightbox element with Image Source = CMS Field was bound to a multi-image field. Single-image fields and File Manager worked fine. This fixes the resolution so multi-image fields render correctly.

Changes

  • Resolve lightbox CMS bindings with the shared parseMultiAssetFieldValue helper so multi-image field values (arrays) are flattened instead of wrapped in a nested array
  • Keep single-value and comma-separated string handling as a fallback
  • Harden the lightbox asset-collection loop to rely on the existing non-string guard instead of calling .startsWith() on raw values, so unexpected shapes can no longer throw and 404 the page

Test plan

  • Bind a Lightbox (Image Source = CMS Field) to a multi-image field on a dynamic CMS page and confirm the item page loads (200) and the lightbox opens with all images
  • Switch the binding to a single-image field — still works
  • Switch the binding to File Manager — still works
  • curl -i the item URL returns 200 and the HTML contains a populated data-lightbox-files attribute

Multi-image CMS fields resolve to an array, but the lightbox resolver
assumed a string and wrapped it in a nested array, which made asset
collection throw and 404 the whole page. Reuse parseMultiAssetFieldValue
and guard the asset loop against non-string values.
@tristan-mouchet tristan-mouchet added the Bug Something isn't working label Aug 3, 2026
@tristan-mouchet tristan-mouchet self-assigned this Aug 3, 2026
@tristan-mouchet
tristan-mouchet merged commit c064cf2 into develop Aug 3, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant