diff --git a/src/js/logic/decrypt.ts b/src/js/logic/decrypt.ts index b77e2c5..ac05860 100644 --- a/src/js/logic/decrypt.ts +++ b/src/js/logic/decrypt.ts @@ -12,7 +12,7 @@ export async function decrypt() { document.getElementById('password-input') as HTMLInputElement )?.value; - if (!password?.trim()) { + if (!password) { showAlert('Input Required', 'Please enter the PDF password.'); return; } @@ -52,7 +52,7 @@ export async function decrypt() { showLoader('Preparing download...'); const outputFile = qpdf.FS.readFile(outputPath, { encoding: 'binary' }); - if (!outputFile || outputFile.length === 0) { + if (outputFile.length === 0) { throw new Error('Decryption resulted in an empty file.'); } diff --git a/src/tests/pdf-tools.test.ts b/src/tests/pdf-tools.test.ts index 8c01723..34b5d0e 100644 --- a/src/tests/pdf-tools.test.ts +++ b/src/tests/pdf-tools.test.ts @@ -19,7 +19,7 @@ describe('Tool Configuration Arrays', () => { it('should have the correct number of tools', () => { // This acts as a snapshot test to catch unexpected additions/removals. - expect(singlePdfLoadTools).toHaveLength(40); + expect(singlePdfLoadTools).toHaveLength(41); }); it('should not contain any duplicate tools', () => {