summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-12-31 09:38:04 +0100
committerYorhel <git@yorhel.nl>2020-12-31 09:38:06 +0100
commitc5ba9db391da5737d3c215d00cd347f984a67dfc (patch)
treed55b188a8b2c43e050fae6d4b15798054f40acb7 /lib
parent16d0e7bac22ae9b39cc12c3249f8ef5c68e3ca71 (diff)
Image upload: Ignore return status of convert, just check if target file exists
I've disabled the 'XML' delegate library, which ImageMagick tries to load when reading a jpeg file with XMP metadata. The image will be processed correctly, but the return status of convert indicates an error. For actual file loading errors, convert would error out before writing the target file, so checking for that ought to be good enough.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNWeb/Images/Upload.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/VNWeb/Images/Upload.pm b/lib/VNWeb/Images/Upload.pm
index 214e87ad..b8625294 100644
--- a/lib/VNWeb/Images/Upload.pm
+++ b/lib/VNWeb/Images/Upload.pm
@@ -39,10 +39,10 @@ TUWF::post qr{/elm/ImageUpload.json}, sub {
$type eq 'sf' ? (-write => $fn0, resize(tuwf->{scr_size}), @unsharp, $fn1) : die
);
- my $e = run_cmd(\@cmd, '<', \$imgdata, '>', \my $out, '2>', \my $err)->recv;
- warn "convert STDERR: $err\n" if $err;
- if($e || $out !~ /^o:([0-9]+)x([0-9]+)r:([0-9]+)x([0-9]+)/) {
- warn "convert STDOUT: $out\n" if $out;
+ run_cmd(\@cmd, '<', \$imgdata, '>', \my $out, '2>', \my $err)->recv;
+ warn "convert STDERR: $err" if $err;
+ if(!-f $fn0 || $out !~ /^o:([0-9]+)x([0-9]+)r:([0-9]+)x([0-9]+)/) {
+ warn "convert STDOUT: $out" if $out;
warn "Failed to run convert\n";
unlink $fn0;
unlink $fn1;