fix: ensure pdf annotations are preserved when sanitizing upload

This commit is contained in:
Björn Fromme
2025-03-18 20:09:50 +01:00
parent 14909a0bc1
commit ed2679ec3e
+4 -1
View File
@@ -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,