Skip to content

Commit

Permalink
🎨 Set filename outside of PDFJSDev environment check
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 committed Jul 15, 2024
1 parent e6efb5a commit ee18393
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,18 +991,20 @@ 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;
if (typeof PDFJSDev !== "undefined" && !PDFJSDev.test("MOZCENTRAL")) {
if (args.url) {
// The Firefox built-in viewer always calls `setTitleUsingUrl`, before
// `initPassiveLoading`, and it never provides an `originalUrl` here.
this.setTitleUsingUrl(
args.originalUrl || args.url,
/* downloadUrl = */ args.url
);
}
} else if (args.url) {
// The Firefox built-in viewer always calls `setTitleUsingUrl`, before
// `initPassiveLoading`, and it never provides an `originalUrl` here.
this.setTitleUsingUrl(
args.originalUrl || args.url,
/* downloadUrl = */ args.url
);
}
if (args.data && isPdfFile(args.filename)) {
this._contentDispositionFilename = args.filename;
}

// Always set `docBaseUrl` in development mode, and in the (various)
// extension builds.
if (typeof PDFJSDev === "undefined") {
Expand Down

0 comments on commit ee18393

Please sign in to comment.