Bugzilla – Attachment 96340 Details for
Bug 24243
Bad characters in MARC cause internal server error when searching catalog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24243: Do not explode if invalid metadata when searching catalogue
Bug-24243-Do-not-explode-if-invalid-metadata-when-.patch (text/plain), 1.90 KB, created by
Liz Rea
on 2019-12-16 14:23:44 UTC
(
hide
)
Description:
Bug 24243: Do not explode if invalid metadata when searching catalogue
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2019-12-16 14:23:44 UTC
Size:
1.90 KB
patch
obsolete
>From 12f530cd9cb09766b0bfd932e1ae120ed5bc2b34 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 15 Dec 2019 12:53:06 +0100 >Subject: [PATCH] Bug 24243: Do not explode if invalid metadata when searching > catalogue > >If the bibliographic record metadata cannot be decoded, the get_coins >call should catch the exception raised by Koha::Biblio::Metadata->record >to not explode > >Error is: "Invalid data, cannot decode objec" > >Test plan: >0/ Do not apply the patch >1/ Search for record at the OPAC >2/ Note one of the biblionumber from the first page result >3/ Set to empty string the biblio_metadata to make the error appears: > update biblio_metadata set metadata="" where biblionumber=42; >4/ Try the same search >=> You get an internal server error >5/ Apply the patch, restart plack and try again >=> It now works, ie. it does not explode > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > opac/opac-search.pl | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 105331009f..96264e4452 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -691,7 +691,8 @@ for (my $i=0;$i<@servers;$i++) { > > if (C4::Context->preference('COinSinOPACResults')) { > my $biblio = Koha::Biblios->find( $res->{'biblionumber'} ); >- $res->{coins} = $biblio ? $biblio->get_coins : q{}; # FIXME This should be moved at the beginning of the @newresults loop >+ # Catch the exception as Koha::Biblio::Metadata->record can explode if the MARCXML is invalid >+ $res->{coins} = $biblio ? eval {$biblio->get_coins} : q{}; # FIXME This should be moved at the beginning of the @newresults loop > } > if ( C4::Context->preference( "Babeltheque" ) and $res->{normalized_isbn} ) { > if( my $isbn = Business::ISBN->new( $res->{normalized_isbn} ) ) { >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24243
:
96295
|
96340
|
96573