Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tienifr committed Jun 17, 2024
1 parent 9ad3602 commit 61666db
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/libs/isPdfFilePasswordProtected/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ const isPdfFilePasswordProtected = (file: FileObject): Promise<boolean> =>
const arrayBuffer = event.target?.result;
if (!arrayBuffer) {
resolve(false);
} else {
try {
const loadingTask = pdfjsLib.getDocument({data: arrayBuffer});
loadingTask.promise.then(
() => {
resolve(false);
},
(error) => {
if (error.name === 'PasswordException') {
resolve(true);
} else {
resolve(false);
}
},
);
} catch (error) {
resolve(false);
}
return;
}
try {
const loadingTask = pdfjsLib.getDocument({data: arrayBuffer});
loadingTask.promise.then(
() => {
resolve(false);
},
(error) => {
if (error.name === 'PasswordException') {
resolve(true);
return;
}
resolve(false);
},
);
} catch (error) {
resolve(false);
}
};

Expand Down

0 comments on commit 61666db

Please sign in to comment.