From 0763c69b6a77803d4a5e28e369d5a1400ea25806 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 10 May 2026 13:51:33 +0200 Subject: [PATCH] Support providing a `filename` unconditionally, when passing binary data to `PDFViewerApplication.open` Previously this was only supported in Firefox, however when merging PDFs the `PDFViewerApplication.onSaveAndLoad` method will provide a `filename` unconditionally. --- web/app.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/web/app.js b/web/app.js index e630ac5d5..1260b9d74 100644 --- a/web/app.js +++ b/web/app.js @@ -1220,11 +1220,12 @@ const PDFViewerApplication = { const workerParams = AppOptions.getAll(OptionKind.WORKER); Object.assign(GlobalWorkerOptions, workerParams); - if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { - if (args.data && isPdfFile(args.filename)) { - this._contentDispositionFilename = args.filename; - } - } else if (args.url) { + if (args.data && isPdfFile(args.filename)) { + this._contentDispositionFilename = args.filename; + } else if ( + (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) && + args.url + ) { // The Firefox built-in viewer always calls `setTitleUsingUrl`, before // `initPassiveLoading`, and it never provides an `originalUrl` here. this.setTitleUsingUrl(