From 760c48886a1ec08c23ba90802a3d630530317dbb Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 24 Oct 2023 12:01:09 +0000 Subject: [PATCH] Bug 35141: Prevent link_bibs_to_authorities from dying on invalid metadata When fetching the record we need to eval in case of exception To test: 1 - Apply first patch 2 - perl misc/link_bibs_to_authorities.pl 3 - Note it dies on parser error at record 369 4 - Apply this patch 5 - perl misc/link_bibs_to_authorities.pl 6 - The process completes - with warning thrown on record 369 Signed-off-by: David Nind Signed-off-by: Marcel de Rooy (cherry picked from commit 706641e747336eeb341172ed3d794d86551a45a9) Signed-off-by: Fridolin Somers (cherry picked from commit ed2bb9534a143b6ab894e6ab4e24d8c7dc9fd58e) Signed-off-by: Matt Blenkinsop --- misc/link_bibs_to_authorities.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc/link_bibs_to_authorities.pl b/misc/link_bibs_to_authorities.pl index 08550c76c0..3dfdd049b7 100755 --- a/misc/link_bibs_to_authorities.pl +++ b/misc/link_bibs_to_authorities.pl @@ -201,7 +201,8 @@ sub process_bib { my $tagtolink = $args->{tagtolink}; my $allowrelink = $args->{allowrelink}; my $biblio = Koha::Biblios->find($biblionumber); - my $record = $biblio->metadata->record; + my $record; + eval{ $record = $biblio->metadata->record; }; unless ( defined $record ) { print "\nCould not retrieve bib $biblionumber from the database - record is corrupt.\n"; -- 2.39.5