https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43709

--- Comment #6 from David Nind <[email protected]> ---
Created attachment 208941
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208941&action=edit
Bug 43709: Cataloging: intermittent 400/403 error when switching MARC framework
in the basic editor

Switching the framework from the "Settings" dropdown in the basic
MARC editor (.change-framework links) intermittently failed with a
400 error instead of reloading the form with the new framework. This
was observed in a production environment; it is timing-dependent and
has not been reliably reproduced on demand in a dev/KTD environment.

Missing e.preventDefault() on the .change-framework click handler.
Changefwk() submits the form via POST, but the triggering link
(href="#") was never cancelled. Depending on browser/timing, the
hash navigation could race with the form submit, and the server
could end up receiving a GET request instead of POST. The CSRF
middleware rejects any GET request carrying op=cud-* => 400.

Fix: add e.preventDefault() to the .change-framework click handler,
so the href="#" navigation never competes with the POST submit.

Bug 37745 and Bug 34478 fixed earlier problems with the framework
switch (duplicated CSS class, missing CSRF token), but this issue
was not caught by either.

Steps to follow:
1. Apply this patch and restart Plack if running under it.
2. In the basic MARC editor (cataloguing/addbiblio.pl), use
   "Settings" > switch framework several times. Confirm it keeps
   working reliably - this does not test the original failure
   directly (it was timing/production-dependent and not reliably
   reproducible on demand), but confirms no regression in the normal
   case.
3. Review the fix: the only change is e.preventDefault() on the
   .change-framework click handler, cancelling the href="#"
   navigation so it can no longer race with the POST submit that
   Changefwk() performs.

Signed-off-by: Adolfo Rodríguez <[email protected]>

Co-Authored-By: Claude Sonnet 5 <[email protected]>

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to