[Bug 41944] New: Error 500 on non-existent ILL request (op=illview)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Bug ID: 41944 Summary: Error 500 on non-existent ILL request (op=illview) Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: ILL Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org CC: lisette@bywatersolutions.com, pedro.amorim@openfifth.co.uk, tomascohen@gmail.com It should be returning the usual 404, but is no checking it and throwing template errors instead. To reproduce: 1. Have KTD launched with an ILL backend loaded: $ ktd --proxy --name rapido --single-plugin ~/git/koha-plugins/rapido-ill up -d $ ktd --shell k$ cd /kohadevbox/plugins/rapido-ill/scripts k$ perl bootstrap_rapido_testing.pl k$ restart_all 2. Log into the instance at `http://rapido-admin.localhost` 3. Point your browser to a [non-existent ILL request](http://rapido-intra.localhost/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1000) => FAIL: Boo, template errors and stacktrace Note: In production, the you get a 500 error and the template errors show up in the logs. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 193981 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193981&action=edit Bug 41944: Fix template error for non-existent ILL requests This patch fixes a template error that occurred when attempting to view a non-existent ILL request in the staff interface. Previously, navigating to ill-requests.pl with an invalid illrequest_id would result in a 500 error and a stacktrace. This change introduces a check for the existence of the ILL request immediately after retrieval. If no request is found, the script now redirects to the standard 404 error page, providing a graceful exit and preventing internal errors. Test plan: 1. Ensure KTD is launched with Rapido ILL plugin and bootstrapped (do NOT apply this patch yet): $ ktd --proxy --name rapido --single-plugin ~/git/koha-plugins/rapido-ill up -d $ ktd --shell k$ cd /kohadevbox/plugins/rapido-ill/scripts k$ perl bootstrap_rapido_testing.pl k$ restart_all 2. Log into the staff interface at http://rapido-intra.localhost. 3. Point your browser to a non-existent ILL request, e.g., http://rapido-intra.localhost/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1000 => FAIL: Template errors and a stacktrace are displayed, or a 500 error in production logs. 4. Apply this patch. 5. Repeat step 3. => SUCCESS: The browser redirects to a 404 Not Found page, and no template errors or stacktraces are displayed. 6. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kkrueger@cuyahogalibrary.or | |g -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #193981|0 |1 is obsolete| | --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 194201 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194201&action=edit Bug 41944: Fix template error for non-existent ILL requests This patch fixes a template error that occurred when attempting to view a non-existent ILL request in the staff interface. Previously, navigating to ill-requests.pl with an invalid illrequest_id would result in a 500 error and a stacktrace. This change introduces a check for the existence of the ILL request immediately after retrieval. If no request is found, the script now redirects to the standard 404 error page, providing a graceful exit and preventing internal errors. Test plan: 1. Ensure KTD is launched with Rapido ILL plugin and bootstrapped (do NOT apply this patch yet): $ ktd --proxy --name rapido --single-plugin ~/git/koha-plugins/rapido-ill up -d $ ktd --shell k$ cd /kohadevbox/plugins/rapido-ill/scripts k$ perl bootstrap_rapido_testing.pl k$ restart_all 2. Log into the staff interface at http://rapido-intra.localhost. 3. Point your browser to a non-existent ILL request, e.g., http://rapido-intra.localhost/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1000 => FAIL: Template errors and a stacktrace are displayed, or a 500 error in production logs. 4. Apply this patch. 5. Repeat step 3. => SUCCESS: The browser redirects to a 404 Not Found page, and no template errors or stacktraces are displayed. 6. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This fixes error 500 and release notes| |stack trace messages being | |shown when attempting to | |access a non-existent ILL | |request in the staff | |interface. Now, if no | |request is found, the | |standard 404 page not found | |error page is shown. CC| |david@davidnind.com --- Comment #3 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. Enable the ILL module (ILLModule system preference). 2. Attempt to view a non-existent ILL request: STAFF-INTERFACE-URL/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1000 3. Stack trace error: Template process failed: file error - : not found at /kohadevbox/koha/C4/Templates.pm line 146 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bibliothek@th-wildau.de QA Contact|testopia@bugs.koha-communit |bibliothek@th-wildau.de |y.org | --- Comment #4 from Jan Kissig <bibliothek@th-wildau.de> --- Hey Tomas instead of throwing the 404 could we use a more detailed error page? There is already a prepared blocking_error for unknown_ill_request in koha3/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc This would also align more to error pages for non existing biblios and patrons: cgi-bin/koha/members/moremember.pl?borrowernumber=151 -> Patron not found. Return to search cgi-bin/koha/catalogue/detail.pl?biblionumber=555 -> The record you requested does not exist (555). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ephetteplace@cca.edu --- Comment #5 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- *** Bug 42259 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |ASSIGNED --- Comment #6 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- (In reply to Jan Kissig from comment #4)
Hey Tomas
instead of throwing the 404 could we use a more detailed error page? There is already a prepared blocking_error for unknown_ill_request in
koha3/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc
This would also align more to error pages for non existing biblios and patrons:
cgi-bin/koha/members/moremember.pl?borrowernumber=151 -> Patron not found. Return to search
cgi-bin/koha/catalogue/detail.pl?biblionumber=555 -> The record you requested does not exist (555).
I iddn't note this comment. Taking a look. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #194201|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #7 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 196746 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196746&action=edit Bug 41944: Fix template error for non-existent ILL requests This patch fixes a template error that occurred when attempting to view a non-existent ILL request in the staff interface. Previously, navigating to ill-requests.pl with an invalid illrequest_id would result in a 500 error and a stacktrace. Instead of redirecting to a generic 404 page, the script now uses output_and_exit with the 'unknown_ill_request' blocking error, which renders a user-friendly 'ILL request not found.' message consistent with how Koha handles other missing resources (e.g. unknown_patron in members/memberentrygen.tt, unknown_biblio in catalogue/detail.tt). The template is wrapped with [% UNLESS blocking_error %] to prevent processing ILL-specific content when the request doesn't exist, following the same pattern used in serials/subscription-detail.tt and members/moremember.tt. Note: the large diff in ill-requests.tt is mostly auto-indentation by the pre-commit tidier. The actual change is just the addition of the UNLESS/END guard. Test plan: 1. Ensure KTD is launched with Rapido ILL plugin and bootstrapped (do NOT apply this patch yet): $ ktd --proxy --name rapido --single-plugin ~/git/koha-plugins/rapido-ill up -d $ ktd --shell k$ cd /kohadevbox/plugins/rapido-ill/scripts k$ perl bootstrap_rapido_testing.pl k$ restart_all 2. Log into the staff interface at http://rapido-intra.localhost. 3. Point your browser to a non-existent ILL request, e.g., http://rapido-intra.localhost/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1000 => FAIL: Template errors and a stacktrace are displayed, or a 500 error in production logs. 4. Apply this patch. 5. Repeat step 3. => SUCCESS: An 'ILL request not found.' message is displayed, consistent with other not-found pages in Koha. 6. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #8 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Hi, Jan (In reply to Jan Kissig from comment #4)
Hey Tomas
instead of throwing the 404 could we use a more detailed error page? There is already a prepared blocking_error for unknown_ill_request in
Good catch! Done in the amended patch! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #9 from Jan Kissig <bibliothek@th-wildau.de> --- Tomas, could you please rebase the patch as I get an error when applying on main branch: Error: Apply failed: Git command (git am -3 /tmp/22xWHg10pQ/0001-196746.patch) failed: error: Failed to merge in the changes. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196746|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #10 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 196824 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196824&action=edit Bug 41944: Fix template error for non-existent ILL requests This patch fixes a template error that occurred when attempting to view a non-existent ILL request in the staff interface. Previously, navigating to ill-requests.pl with an invalid illrequest_id would result in a 500 error and a stacktrace. The Perl-side fix (output_and_exit with 'unknown_ill_request') was already applied. This patch adds the template-side guard: wrapping the ILL content with [% UNLESS blocking_error %] to prevent processing ILL-specific content when the request doesn't exist, following the same pattern used in serials/subscription-detail.tt and members/moremember.tt. Test plan: 1. Ensure KTD is launched with Rapido ILL plugin and bootstrapped: $ ktd --proxy --name rapido --single-plugin ~/git/koha-plugins/rapido-ill up -d $ ktd --shell k$ cd /kohadevbox/plugins/rapido-ill/scripts k$ perl bootstrap_rapido_testing.pl k$ restart_all 2. Log into the staff interface at http://rapido-intra.localhost. 3. Point your browser to a non-existent ILL request, e.g., http://rapido-intra.localhost/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1000 => SUCCESS: An 'ILL request not found.' message is displayed, consistent with other not-found pages in Koha. 4. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #11 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Hi, (In reply to Jan Kissig from comment #9)
Tomas, could you please rebase the patch as I get an error when applying on main branch:
Error: Apply failed: Git command (git am -3 /tmp/22xWHg10pQ/0001-196746.patch) failed: error: Failed to merge in the changes.
thanks for checking. The patch is minimal, but the TT linter changes a lot of things due to the new indentation level. Should be fixed now. PS: Please mark as 'Patch does not apply' in this cases. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196824|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #12 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 196905 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196905&action=edit Bug 41944: Fix template error for non-existent ILL requests This patch fixes a template error that occurred when attempting to view a non-existent ILL request in the staff interface. Previously, navigating to ill-requests.pl with an invalid illrequest_id would result in a 500 error and a stacktrace. The Perl-side fix (output_and_exit with 'unknown_ill_request') was already applied. This patch adds the template-side guard: wrapping the ILL content with [% UNLESS blocking_error %] to prevent processing ILL-specific content when the request doesn't exist, following the same pattern used in serials/subscription-detail.tt and members/moremember.tt. Test plan: 1. Ensure KTD is launched with Rapido ILL plugin and bootstrapped: $ ktd --proxy --name rapido --single-plugin ~/git/koha-plugins/rapido-ill up -d $ ktd --shell k$ cd /kohadevbox/plugins/rapido-ill/scripts k$ perl bootstrap_rapido_testing.pl k$ restart_all 2. Log into the staff interface at http://rapido-intra.localhost. 3. Point your browser to a non-existent ILL request, e.g., http://rapido-intra.localhost/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1000 => SUCCESS: An 'ILL request not found.' message is displayed, consistent with other not-found pages in Koha. 4. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #13 from Jan Kissig <bibliothek@th-wildau.de> --- (In reply to Tomás Cohen Arazi (tcohen) from comment #11)
Hi,
(In reply to Jan Kissig from comment #9)
Tomas, could you please rebase the patch as I get an error when applying on main branch:
Error: Apply failed: Git command (git am -3 /tmp/22xWHg10pQ/0001-196746.patch) failed: error: Failed to merge in the changes.
thanks for checking. The patch is minimal, but the TT linter changes a lot of things due to the new indentation level.
Should be fixed now.
PS: Please mark as 'Patch does not apply' in this cases.
Thank you Tomás for the hint and the fixed patch. Now it applies/works perfectly and the error message for non existent ill requests fits the common error messages. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.05.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #14 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|26.05.00 |26.05.00,25.11.05 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41944 --- Comment #15 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- Thanks all, pushed to 25.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org