word/edit: fix thumbnail generation warnings
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 15 Aug 2021 02:20:44 +0000 (04:20 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 25 Aug 2021 04:53:32 +0000 (06:53 +0200)
Shiar_Sheet/ImagePrep.pm
writer.plp

index 699d2243bad110b1f893b3d41cb2473552d26e66..4fc33b64639a82ae1cfb71c745ecb1617bf4d3d0 100644 (file)
@@ -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
index fe538ddb5bbe4fc8145f531050084f9480f18541..a5aa431cf188dca558183c9aec9738c16b8944bd 100644 (file)
@@ -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 {