fix(zmi): POST for Advanced-tab Update/Rebuild forms (#188)#190
Merged
Conversation
The Update Catalog and Clear and Rebuild buttons in catalogAdvanced.dtml had no form method, so they submitted via GET. The (destructive) action then stayed in the URL bar and a reload / Back / prefetch silently re-ran it — observed on production as a second full clear+rebuild kicked off by a browser reload mid-rebuild. Add method="post" to both forms; the handlers already redirect, giving a clean Post/Redirect/Get flow. Closes #188 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The Update Catalog and Clear and Rebuild buttons on the PG Catalog Tool's Advanced ZMI tab submit via GET — the forms in
catalogAdvanced.dtmlhave nomethod(HTML defaults to GET). With Zope's:methodpublishing, the action runs as a GET whose URL stays in the address bar, so a reload / Back / Forward / prefetch / link-scanner silently re-triggers it.For Clear and Rebuild that is destructive. Observed on a ~20k-object production site: a browser reload while the long rebuild was in flight kicked off a second full clear+rebuild (catalog count dropped back toward zero and started climbing again). The
onclick confirm()is a UX guard only — it does not run on reload.Fix
Add
method="post"to both forms. The handlers (manage_catalogReindex/manage_catalogRebuild) alreadyRESPONSE.redirect(...)back tomanage_catalogAdvanced, so this is a clean Post/Redirect/Get flow. This also makes the Advanced tab consistent withcatalogSlowQueries.dtml, which already POSTs.Tests
tests/test_advanced_tab_forms.py(3): both state-changing forms usemethod="post", and no form in the template defaults to GET.Closes #188
🤖 Generated with Claude Code