1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Remove unnecessary else if when checking the encryptionKey in the CipherTransformFactory constructor

This can be simplified a tiny bit since we already throw `PasswordException` when no password is provided.
This commit is contained in:
Jonas Jenwald 2025-03-13 10:17:15 +01:00
parent cc63ffa6bb
commit 0e15f709c4

View file

@ -1125,12 +1125,13 @@ class CipherTransformFactory {
perms
);
}
if (!encryptionKey && !password) {
throw new PasswordException(
"No password given",
PasswordResponses.NEED_PASSWORD
);
} else if (!encryptionKey && password) {
if (!encryptionKey) {
if (!password) {
throw new PasswordException(
"No password given",
PasswordResponses.NEED_PASSWORD
);
}
// Attempting use the password as an owner password
const decodedPassword = this.#decodeUserPassword(
passwordBytes,