Merge branch 'master' into feature/timeline
This commit is contained in:
@@ -22,7 +22,9 @@ class Sanitizer
|
||||
$filesystem = new Filesystem();
|
||||
|
||||
if (true === $backup) {
|
||||
$filesystem->copy($inputFilepath, $inputFilepath.'.bak');
|
||||
$parts = pathinfo($inputFilepath);
|
||||
$backupFilename = sprintf('%s/%s.orig.%s', $parts['dirname'], $parts['filename'], $parts['extension']);
|
||||
$filesystem->copy($inputFilepath, $backupFilename);
|
||||
}
|
||||
|
||||
$tempFilename = sha1($inputFilepath);
|
||||
@@ -57,6 +59,7 @@ class Sanitizer
|
||||
'-dNOPAUSE',
|
||||
'-dQUIET',
|
||||
'-dBATCH',
|
||||
'-dPreserveAnnots=false',
|
||||
'-sDEVICE=pdfwrite',
|
||||
'-dCompatibilityLevel=1.4',
|
||||
'-sOutputFile='.$outputFilepath,
|
||||
|
||||
@@ -141,7 +141,10 @@ class UploadHandler
|
||||
$sanitizedFilepath = $this->sanitizer->sanitizeFile($filepath);
|
||||
|
||||
if ($filepath !== $sanitizedFilepath) {
|
||||
$upload->setFilename(basename($sanitizedFilepath));
|
||||
$upload
|
||||
->setFilename(basename($sanitizedFilepath))
|
||||
->setMimeType('application/pdf')
|
||||
;
|
||||
}
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user