From 3deaf926407a409599b32b08cd3e69bfb5f2f6a6 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 --- 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 4bd2e57e8f9..ff32d0889c3 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.34.1