From 767e5b120920304affd5d4d3c08692a2a7c041a6 Mon Sep 17 00:00:00 2001 From: Sergey Konovalov Date: Wed, 7 Aug 2024 00:33:20 +0300 Subject: [PATCH] [bug] Fix crash while applying changes to pdf --- FileConverter/sources/converter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FileConverter/sources/converter.js b/FileConverter/sources/converter.js index 1269a6d35..41323acf4 100644 --- a/FileConverter/sources/converter.js +++ b/FileConverter/sources/converter.js @@ -520,7 +520,6 @@ function* processDownloadFromStorage(ctx, dataConvert, cmd, task, tempDirs, auth }); } } - yield changeFormatToExtendedPdf(ctx, dataConvert, cmd); //todo rework if (!fs.existsSync(dataConvert.fileFrom)) { if (fs.existsSync(path.join(tempDirs.source, 'origin.docx'))) { @@ -529,12 +528,16 @@ function* processDownloadFromStorage(ctx, dataConvert, cmd, task, tempDirs, auth dataConvert.fileFrom = path.join(tempDirs.source, 'origin.xlsx'); } else if (fs.existsSync(path.join(tempDirs.source, 'origin.pptx'))) { dataConvert.fileFrom = path.join(tempDirs.source, 'origin.pptx'); + } else if (fs.existsSync(path.join(tempDirs.source, 'origin.pdf'))) { + dataConvert.fileFrom = path.join(tempDirs.source, 'origin.pdf'); } let fileFromNew = path.join(path.dirname(dataConvert.fileFrom), "Editor.bin"); fs.renameSync(dataConvert.fileFrom, fileFromNew); dataConvert.fileFrom = fileFromNew; } + yield changeFormatToExtendedPdf(ctx, dataConvert, cmd); + if (task.getFromChanges() && !(task.getFromOrigin() || task.getFromSettings())) { let sha256 = yield utils.checksumFile('sha256', dataConvert.fileFrom) if(tenEditor['binaryChanges']) {