From 05929e84ace707ac19549c9250b1ca5f094d0447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Niclas=20W=C3=A4chtler?= <54584804+cubexy@users.noreply.github.com> Date: Sat, 4 Oct 2025 17:04:34 +0200 Subject: [PATCH] Adjust capture group to allow for brackets in file names - Adjusted capture group with lazy matching to only fetch the first `[[` - Also adjusted the pdfBuffer list to a const --- main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index 7ff1eea..96f9d1b 100644 --- a/main.ts +++ b/main.ts @@ -82,7 +82,7 @@ export default class PdfPrinterPlugin extends Plugin { * @returns found file path (something) or null */ private checkPathInput(input: string): string | null { - const matches = input.match(/!\[\[([^\]]+)\]\]/); // match ![[something]], -> something (capture group 1) + const matches = input.match(/!\[\[(.+?)\]\]/); // match ![[something]], -> something (capture group 1) if (matches && matches[1]) { return matches[1]; } @@ -134,7 +134,7 @@ export default class PdfPrinterPlugin extends Plugin { const document = await pdfjs.getDocument(buffer).promise; const pages: number = document.numPages; - let pdfBuffer: PdfPage[] = []; + const pdfBuffer: PdfPage[] = []; for (let i = 1; i <= pages; i++) { const page = await document.getPage(i);