From 4ada46ca567cb6d929a1297845422f6b3cf06e0d Mon Sep 17 00:00:00 2001 From: plind <59729252+plind-dm@users.noreply.github.com> Date: Mon, 13 Apr 2026 16:38:42 -0700 Subject: [PATCH] Fix encrypted PDF unlock modal missing on IndexedDB restore and large files (#6099) --- frontend/src/core/contexts/file/fileActions.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/core/contexts/file/fileActions.ts b/frontend/src/core/contexts/file/fileActions.ts index ac6d71d691..2c571d3c70 100644 --- a/frontend/src/core/contexts/file/fileActions.ts +++ b/frontend/src/core/contexts/file/fileActions.ts @@ -391,8 +391,15 @@ export async function addFiles( let thumbnail: string | undefined; if (targetFile.type.startsWith("application/pdf")) { - processedFileMetadata = await generateProcessedFileMetadata(targetFile); - thumbnail = processedFileMetadata?.thumbnailUrl; + if (fileStub.processedFile?.isEncrypted) { + // Pre-dispatch detection already flagged this PDF as encrypted; PDF.js + // can't produce thumbnails/metadata without the password, so re-parsing + // here would just duplicate work. Metadata is refreshed after unlock. + processedFileMetadata = fileStub.processedFile; + } else { + processedFileMetadata = await generateProcessedFileMetadata(targetFile); + thumbnail = processedFileMetadata?.thumbnailUrl; + } } else { try { const { generateThumbnailForFile } = await import("@app/utils/thumbnailUtils");