Skip to content

Preserve all story images when saving the images form - #252

Merged
norkans7 merged 2 commits into
mainfrom
story-image-loss
Jul 27, 2026
Merged

Preserve all story images when saving the images form#252
norkans7 merged 2 commits into
mainfrom
story-image-loss

Conversation

@norkans7

Copy link
Copy Markdown
Contributor

The story images form renders a field for every existing image, but on save it deleted all of the story's images and recreated only the first three — a story with four or more images (e.g. created via the API or shell) silently lost the rest when an editor saved the page.

The save handler now iterates over every rendered image field, so nothing that was displayed is dropped; clearing a field still removes that image. Includes a regression test with a 4-image story.

norkans7 added 2 commits July 27, 2026 13:34
The images form renders a field for every existing image, but saving
only recreated images 1-3, silently dropping any additional images.
Iterate over all rendered image fields instead of a hardcoded range.
Instead of deleting and recreating all images on every save, keep
unchanged images as they are, remove only cleared or replaced ones,
and create new rows just for new uploads. This preserves each image's
name and audit fields, and stops the form from resurrecting soft
deleted images, which are now also excluded from the form.
@norkans7
norkans7 merged commit fbab92b into main Jul 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant