From c3f0732eb72dfb3c4c6000a8602424772bd46b61 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 1 Jul 2019 15:52:02 -0300 Subject: [PATCH] Bug 23248: Avoid opac-ISBDdetail.pl breaking on invalid biblionumber This patch makes opac-ISBDdetail.pl redirect to a 404 page (as it should) in the event of a bad biblionumber passed. To test: - Open your browser on a known record detail page (OPAC) - Switch to the ISBD view => SUCCESS: It shows - Alter the biblionumber on the URL into an obviously non-existent biblionumber (e.g. very high value) => FAIL: Internal errors are shown - Apply this patch - Reload the bad biblionumber ISBD view => SUCCESS: Browser is redirected to the 404 page as it should - Sign off :-=> FAIL: Internal errors are shown - Apply this patch - Reload the bad biblionumber ISBD view => SUCCESS: Browser is redirected to the 404 page as it should - Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Mark Tompsett Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- opac/opac-ISBDdetail.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index e4a0b3fcad..4305d8c483 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -76,8 +76,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); - my $biblio = Koha::Biblios->find( $biblionumber, { prefetch => [ 'metadata', 'items' ] } ); +unless ( $biblio ) { + print $query->redirect("/cgi-bin/koha/errors/404.pl"); + exit; +} + my $patron = Koha::Patrons->find($loggedinuser); my $opachiddenitems_rules;