Repository navigation
Delete only the chart's own image when the image changes - #1425
Open
vytisbulkevicius wants to merge 1 commit into
Open
vytisbulkevicius wants to merge 1 commit into
vytisbulkevicius wants to merge 1 commit into
Conversation
The old image was deleted by the ID in the chart meta, whatever that ID named. An image save also needs the editor nonce now. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A chart can keep a copy of itself as an image in the Media Library. When the image changes, the plugin now deletes only the image file that belongs to that chart, and the save request needs its nonce.
What changed
Chart image save — the request that stores a new chart image must carry a valid nonce. A request without one stores nothing.
Old chart image — the earlier attachment is deleted only when its file is
visualization-<chart id>.png. Any other attachment stays in the Media Library.Note
Tracked in Codeinwp/visualizer-pro#653.
QA
Go to
WP Admin → Visualizer → Chart Libraryand edit a chart. OpenSettings → General → Save chart as an image inside Media Library, turn on Save inside media library? and save the chart.Expect:
WP Admin → Mediashows one image namedvisualization-<chart id>.Edit the same chart, change its title and save it again.
Expect:
WP Admin → Mediastill shows one image for the chart, and no other media item is gone.🤖 Generated with Claude Code