From 87dfb224d72e7513464411d0d82af417ea433a78 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 6 Nov 2023 13:11:49 +0000 Subject: [PATCH] Bug 35266: Fix biblio check in opac-MARCdetail Content-Type: text/plain; charset=utf-8 We should check before retrieving metadata. Test plan; Try /cgi-bin/koha/opac-MARCdetail?biblionumber=X Replace X by a not-existing biblionumber. Verify that you get a 404 error page. Signed-off-by: Marcel de Rooy --- opac/opac-MARCdetail.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 9b85bbbe1e..1ad94ca3be 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -92,8 +92,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $patron = Koha::Patrons->find($loggedinuser); my $biblio = Koha::Biblios->find($biblionumber); -my $record = $biblio->metadata->record; +my $record; +$record = $biblio->metadata->record if $biblio; if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; -- 2.30.2