From cd666e3a370fc666bd68369d26556b68a30fc37d Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 24 Apr 2020 11:50:58 +0200 Subject: [PATCH] Use the native `URL.createObjectURL` method in `web/pdf_attachment_viewer.js` There's no particular reason for using the PDF.js helper function `createObjectURL` here, given that the relevant code-path is already guarded by multiple "disableCreateObjectURL" option checks. --- web/pdf_attachment_viewer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/pdf_attachment_viewer.js b/web/pdf_attachment_viewer.js index d3ab20216..a8c2dbefa 100644 --- a/web/pdf_attachment_viewer.js +++ b/web/pdf_attachment_viewer.js @@ -14,7 +14,6 @@ */ import { - createObjectURL, createPromiseCapability, getFilenameFromUrl, removeNullCharacters, @@ -86,7 +85,9 @@ class PDFAttachmentViewer { let blobUrl; button.onclick = function () { if (!blobUrl) { - blobUrl = createObjectURL(content, "application/pdf"); + blobUrl = URL.createObjectURL( + new Blob([content], { type: "application/pdf" }) + ); } let viewerUrl; if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {