diff --git a/web/app.js b/web/app.js index 4de56452c..354121b72 100644 --- a/web/app.js +++ b/web/app.js @@ -1858,7 +1858,7 @@ function webViewerInitialized() { file = "file" in params ? params.file : AppOptions.get("defaultUrl"); validateFileURL(file); } else if (PDFJSDev.test("MOZCENTRAL")) { - file = window.location.href.split("#")[0]; + file = window.location.href; } else if (PDFJSDev.test("CHROME")) { file = AppOptions.get("defaultUrl"); } diff --git a/web/pdf_attachment_viewer.js b/web/pdf_attachment_viewer.js index de1a63df6..198162b93 100644 --- a/web/pdf_attachment_viewer.js +++ b/web/pdf_attachment_viewer.js @@ -95,7 +95,7 @@ class PDFAttachmentViewer { viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename); } else if (PDFJSDev.test("MOZCENTRAL")) { // Let Firefox's content handler catch the URL and display the PDF. - viewerUrl = blobUrl + "?" + encodeURIComponent(filename); + viewerUrl = blobUrl + "#filename=" + encodeURIComponent(filename); } else if (PDFJSDev.test("CHROME")) { // In the Chrome extension, the URL is rewritten using the history API // in viewer.js, so an absolute URL must be generated. diff --git a/web/ui_utils.js b/web/ui_utils.js index 74ac2c633..c24ee9907 100644 --- a/web/ui_utils.js +++ b/web/ui_utils.js @@ -610,7 +610,7 @@ function getPDFFileNameFromURL(url, defaultFilename = "document.pdf") { return defaultFilename; } const reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/; - // SCHEME HOST 1.PATH 2.QUERY 3.REF + // SCHEME HOST 1.PATH 2.QUERY 3.REF // Pattern to get last matching NAME.pdf const reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i; const splitURI = reURI.exec(url);