From 6023acd648110297a87c65d1b6d024584ac1bc06 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 8 Nov 2023 17:14:55 +0100 Subject: [PATCH] Bug 35291: Prevent leaks from FS Signed-off-by: David Cook Signed-off-by: Nick Clemens Signed-off-by: Aleisha Amohia Signed-off-by: Tomas Cohen Arazi --- tools/upload-cover-image.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/upload-cover-image.pl b/tools/upload-cover-image.pl index 4bd2e57e8f..ff32d0889c 100755 --- a/tools/upload-cover-image.pl +++ b/tools/upload-cover-image.pl @@ -175,9 +175,9 @@ if ($fileID) { : ""; unless ( $delim eq "," || $delim eq "\t" ) { - warn -"Unrecognized or missing field delimeter. Please verify that you are using either a ',' or a 'tab'"; + warn "Unrecognized or missing field delimeter. Please verify that you are using either a ',' or a 'tab'"; $error = 'DELERR'; + next; } else { ( $biblionumber, $filename ) = split $delim, $line, 2; @@ -186,9 +186,6 @@ if ($fileID) { $filename =~ s/[\"\r\n]//g; $filename =~ s/^\s+//; $filename =~ s/\s+$//; - if (C4::Context->preference("CataloguingLog")) { - logaction('CATALOGUING', 'MODIFY', $biblionumber, "biblio cover image: $filename"); - } my $srcimage = GD::Image->new("$dir/$filename"); my $biblio; my $item; @@ -238,6 +235,11 @@ if ($fileID) { $error = 'OPNIMG'; } undef $srcimage; + + if (!$error && C4::Context->preference("CataloguingLog")) { + logaction('CATALOGUING', 'MODIFY', $biblionumber, "biblio cover image: $filename"); + } + } } close($fh); -- 2.39.5