From a58594c9f79e5562f99f7c69c2c0e717d5b66491 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 15 Aug 2021 04:20:44 +0200 Subject: [PATCH] word/edit: fix thumbnail generation warnings --- Shiar_Sheet/ImagePrep.pm | 2 +- writer.plp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Shiar_Sheet/ImagePrep.pm b/Shiar_Sheet/ImagePrep.pm index 699d224..4fc33b6 100644 --- a/Shiar_Sheet/ImagePrep.pm +++ b/Shiar_Sheet/ImagePrep.pm @@ -26,7 +26,7 @@ sub download { sub convert { my ($imgpath, $thumbpath, $cmds) = @_; if (not -e $$imgpath) { - return unlink $thumbpath; + return !-e $thumbpath || unlink $thumbpath; } my $xyres = 0 ? '600x400' : '300x200'; # cover diff --git a/writer.plp b/writer.plp index fe538dd..a5aa431 100644 --- a/writer.plp +++ b/writer.plp @@ -202,7 +202,10 @@ elsif (defined $post{form}) {{ if ($reimage) { eval { $image->convert($wordcol{thumb}->{-src}->($row), $row->{thumb}); - } or Alert([ "Thumbnail image not generated", $@->[0] ], $@->[1]); + } or do { + my ($warn, @details) = ref $@ ? @{$@} : $@; + Alert([ "Thumbnail image not generated", $warn ], @details); + }; } }} else { -- 2.30.0