https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41918 --- Comment #29 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 198274 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198274&action=edit Bug 41918: (QA follow-up) Catch DuplicateRunning in op=export path The CSV/tab export branch (op=export) of reports/guided_reports.pl calls Koha::Report::prep_report just like the op=run branch and the two svc/report endpoints, but unlike the others it had no eval/catch around the call. The QA follow-ups that pushed enforcement into the model layer therefore left this one path emitting a 500 (uncaught Koha::Exceptions::Report::DuplicateRunning) when the configured duplicate-running limit is exceeded. Wrap the call in the same pattern as svc/report: on DuplicateRunning return HTTP 429 Too Many Requests with a plain-text body explaining the situation. Plain text rather than the staff template because op=export sets file-download headers and the user is expecting either the file or an error - we don't have a sensible way to fall back into the report-run template from this branch. The CLI runners (misc/cronjobs/runreport.pl, misc/export_records.pl) still bypass prep_report and therefore the limit, which is intended: scheduled / batch jobs should not be subject to user-quota enforcement. Test plan: 1) Set duplicate_running_reports_per_user_limit=1 in koha-conf.xml, restart_all. 2) Start a long-running report from the staff UI. 3) While it is running, navigate to op=export with the same report id (eg. via the "Export" button). 4) Before the patch: 500 with a stack trace in the logs. After the patch: 429 with body "This report is already running. Please wait for it to finish before running it again." 5) Set the limit back to 0 and confirm exports work normally again. -- You are receiving this mail because: You are watching all bug changes.