From fb2c3df2944acfc62f3688040131147694717b39 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 23 Nov 2021 12:14:00 +0100 Subject: [PATCH] =?utf8?q?=5Fconvert=5Fpdf=5Fto=5Fpng:=20Mehr=20Warnungen?= =?utf8?q?=20-=20quotemeta=20f=C3=BCr=20Dateinamen=20mit=20whitespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/File.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SL/Controller/File.pm b/SL/Controller/File.pm index 9005d79d6..7cd9406d0 100644 --- a/SL/Controller/File.pm +++ b/SL/Controller/File.pm @@ -679,7 +679,12 @@ sub _convert_pdf_to_png { my $size = $params{size} // 64; my $sfile = SL::SessionFile::Random->new(); - my $command = 'pdftoppm -singlefile -scale-to ' . $size . ' -png' . ' ' . $filename . ' ' . $sfile->file_name; + unless (-f $filename) { + $::lxdebug->message(LXDebug::WARN(), "_convert_pdf_to_png failed, no file found: $filename"); + return; + } + # quotemeta for storno case "storno\ zu\ 1020" *nix only + my $command = 'pdftoppm -singlefile -scale-to ' . $size . ' -png' . ' ' . quotemeta($filename) . ' ' . $sfile->file_name; if (system($command) == -1) { $::lxdebug->message(LXDebug::WARN(), "SL::File::_convert_pdf_to_png: system call failed: " . $ERRNO); @@ -687,6 +692,7 @@ sub _convert_pdf_to_png { } if ($CHILD_ERROR) { $::lxdebug->message(LXDebug::WARN(), "SL::File::_convert_pdf_to_png: pdftoppm failed with error code: " . ($CHILD_ERROR >> 8)); + $::lxdebug->message(LXDebug::WARN(), "SL::File::_convert_pdf_to_png: File: $filename"); return; } -- 2.20.1