fix(Read PDF Node): Disable JS evaluation from PDFs (#9336)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-05-08 12:53:23 +02:00 committed by GitHub
parent 695e762663
commit c4bf5b2b92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,6 +7,7 @@ import get from 'lodash/get';
import iconv from 'iconv-lite'; import iconv from 'iconv-lite';
import { getDocument as readPDF, version as pdfJsVersion } from 'pdfjs-dist'; import { getDocument as readPDF, version as pdfJsVersion } from 'pdfjs-dist';
import type { DocumentInitParameters } from 'pdfjs-dist/types/src/display/api';
import { flattenObject } from '@utils/utilities'; import { flattenObject } from '@utils/utilities';
export type JsonToSpreadsheetBinaryFormat = 'csv' | 'html' | 'rtf' | 'ods' | 'xls' | 'xlsx'; export type JsonToSpreadsheetBinaryFormat = 'csv' | 'html' | 'rtf' | 'ods' | 'xls' | 'xlsx';
@ -157,7 +158,7 @@ export async function extractDataFromPDF(
) { ) {
const binaryData = this.helpers.assertBinaryData(itemIndex, binaryPropertyName); const binaryData = this.helpers.assertBinaryData(itemIndex, binaryPropertyName);
const params: { password?: string; url?: URL; data?: ArrayBuffer } = { password }; const params: DocumentInitParameters = { password, isEvalSupported: false };
if (binaryData.id) { if (binaryData.id) {
params.data = await this.helpers.binaryToBuffer( params.data = await this.helpers.binaryToBuffer(