Skip to content
Snippets Groups Projects
Commit 298951f1 authored by Zdravko Iliev's avatar Zdravko Iliev
Browse files

fix subfilter return

parent 6215f35f
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,8 @@ const checkForSubFilter = (pdfBuffer) => { ...@@ -7,7 +7,8 @@ const checkForSubFilter = (pdfBuffer) => {
const matches = pdfBuffer.toString().match(/\/SubFilter\s*\/([\w.]*)/); const matches = pdfBuffer.toString().match(/\/SubFilter\s*\/([\w.]*)/);
const subFilter = Array.isArray(matches) && matches[1]; const subFilter = Array.isArray(matches) && matches[1];
if (!subFilter) { if (!subFilter) {
throw new errors_1.AppError("Can not find subfilter"); //SubFilter is only available if there is a sig in the pdf
return;
} }
const supportedTypes = [ const supportedTypes = [
"adbe.pkcs7.detached", "adbe.pkcs7.detached",
......
...@@ -10,8 +10,7 @@ const verifyPDF = (pdf) => { ...@@ -10,8 +10,7 @@ const verifyPDF = (pdf) => {
(0, generalUtils_1.checkForSubFilter)(pdfBuffer); (0, generalUtils_1.checkForSubFilter)(pdfBuffer);
} }
catch (error) { catch (error) {
//SubFilter is only available if there is a sig in the pdf throw new Error(error.message);
return null;
} }
try { try {
const { signatureStr, signedData, signatureMeta } = (0, signatureUtils_1.extractSignature)(pdfBuffer); const { signatureStr, signedData, signatureMeta } = (0, signatureUtils_1.extractSignature)(pdfBuffer);
......
...@@ -7,7 +7,8 @@ export const checkForSubFilter = (pdfBuffer: Buffer) => { ...@@ -7,7 +7,8 @@ export const checkForSubFilter = (pdfBuffer: Buffer) => {
const subFilter = Array.isArray(matches) && matches[1]; const subFilter = Array.isArray(matches) && matches[1];
if (!subFilter) { if (!subFilter) {
throw new AppError("Can not find subfilter"); //SubFilter is only available if there is a sig in the pdf
return;
} }
const supportedTypes = [ const supportedTypes = [
......
...@@ -7,8 +7,7 @@ export const verifyPDF = (pdf: Buffer) => { ...@@ -7,8 +7,7 @@ export const verifyPDF = (pdf: Buffer) => {
try { try {
checkForSubFilter(pdfBuffer); checkForSubFilter(pdfBuffer);
} catch (error) { } catch (error) {
//SubFilter is only available if there is a sig in the pdf throw new Error(error.message);
return null;
} }
try { try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment