🤖 format everything with pre-commit by stirlingbot (#3882)

Auto-generated by [create-pull-request][1] with **stirlingbot**

[1]: https://github.com/peter-evans/create-pull-request

Signed-off-by: stirlingbot[bot] <stirlingbot[bot]@users.noreply.github.com>
Co-authored-by: stirlingbot[bot] <195170888+stirlingbot[bot]@users.noreply.github.com>
This commit is contained in:
stirlingbot[bot] 2025-07-07 10:05:50 +01:00 committed by GitHub
parent b4f8b896d1
commit 7fa5e130d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -125,7 +125,7 @@ export class DecryptFile {
} else if (error.code === pdfjsLib.PasswordResponses.INCORRECT_PASSWORD) {
return {isEncrypted: true, requiresPassword: false};
}
} else if (error.name === 'InvalidPDFException' ||
} else if (error.name === 'InvalidPDFException' ||
(error.message && error.message.includes('Invalid PDF structure'))) {
// Handle corrupted PDF files
console.error('Corrupted PDF detected:', error);

View File

@ -238,7 +238,7 @@
);
throw decryptError;
}
} else if (error.name === 'InvalidPDFException' ||
} else if (error.name === 'InvalidPDFException' ||
(error.message && error.message.includes('Invalid PDF structure'))) {
// Handle corrupted PDF files
console.log(`Corrupted PDF detected: ${file.name}`, error);

View File

@ -226,7 +226,7 @@ function setupFileInput(chooser) {
try {
const { isEncrypted, requiresPassword } = await decryptFile.checkFileEncrypted(file);
if (file.type === 'application/pdf' && isEncrypted &&
if (file.type === 'application/pdf' && isEncrypted &&
!window.location.pathname.includes('remove-password')) {
decryptedFile = await decryptFile.decryptFile(file, requiresPassword);
if (!decryptedFile) throw new Error('File decryption failed.');
@ -236,13 +236,13 @@ function setupFileInput(chooser) {
} catch (error) {
console.error(`Error decrypting file: ${file.name}`, error);
// Check if this is a PDF corruption error
if (error.message && error.message.includes('PDF file is corrupted')) {
// The error banner is already shown by DecryptFiles.js, just continue with the file
console.warn(`Continuing with corrupted PDF file: ${file.name}`);
}
if (!file.uniqueId) file.uniqueId = UUID.uuidv4();
return file;
}