From 600e6334fc82122f7ad4220c5a70fb10506f6627 Mon Sep 17 00:00:00 2001 From: Alexander Alemayhu Date: Thu, 12 Dec 2024 04:45:05 +0100 Subject: [PATCH] fix: ensure we are passing PDF to pdfinfo --- src/lib/pdf/convertPDFToImages.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/pdf/convertPDFToImages.ts b/src/lib/pdf/convertPDFToImages.ts index 4420f0da..bee02daf 100644 --- a/src/lib/pdf/convertPDFToImages.ts +++ b/src/lib/pdf/convertPDFToImages.ts @@ -21,10 +21,10 @@ export async function convertPDFToImages( input: ConvertPDFToImagesInput ): Promise { const { contents, workspace, noLimits, name } = input; - const pdfPath = path.join( - workspace.location, - name ? path.basename(name) : 'Default.pdf' - ); + const fileName = name + ? path.basename(name).replace(/\.pptx?$/i, '.pdf') + : 'Default.pdf'; + const pdfPath = path.join(workspace.location, fileName); if (!existsSync(pdfPath)) { await writeFile(pdfPath, Buffer.from(contents as Buffer));