Fix encrypted PDF unlock modal missing on IndexedDB restore and large files (#6099)

This commit is contained in:
plind
2026-04-14 00:38:42 +01:00
committed by GitHub
parent 76aa5c7e2f
commit 4ada46ca56
@@ -391,8 +391,15 @@ export async function addFiles(
let thumbnail: string | undefined; let thumbnail: string | undefined;
if (targetFile.type.startsWith("application/pdf")) { if (targetFile.type.startsWith("application/pdf")) {
processedFileMetadata = await generateProcessedFileMetadata(targetFile); if (fileStub.processedFile?.isEncrypted) {
thumbnail = processedFileMetadata?.thumbnailUrl; // 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 { } else {
try { try {
const { generateThumbnailForFile } = await import("@app/utils/thumbnailUtils"); const { generateThumbnailForFile } = await import("@app/utils/thumbnailUtils");