mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Move the getPdfFilenameFromUrl
helper function from web/ui_utils.js
and into src/display/display_utils.js
It seems reasonable to place this alongside the *similar* `getFilenameFromUrl` helper function. This way, with the changes in the next patch, we also avoid having to expose the `isDataScheme` function in the API itself and we instead expose `getPdfFilenameFromUrl` in the API (which feels overall more appropriate).
This commit is contained in:
parent
a164941351
commit
bd9dee1544
8 changed files with 225 additions and 226 deletions
|
@ -22,7 +22,6 @@ import {
|
|||
DEFAULT_SCALE_VALUE,
|
||||
EventBus,
|
||||
getActiveOrFocusedElement,
|
||||
getPDFFileNameFromURL,
|
||||
isValidRotation,
|
||||
isValidScrollMode,
|
||||
isValidSpreadMode,
|
||||
|
@ -44,6 +43,7 @@ import {
|
|||
createPromiseCapability,
|
||||
getDocument,
|
||||
getFilenameFromUrl,
|
||||
getPdfFilenameFromUrl,
|
||||
GlobalWorkerOptions,
|
||||
InvalidPDFException,
|
||||
isPdfFile,
|
||||
|
@ -748,7 +748,7 @@ const PDFViewerApplication = {
|
|||
setTitleUsingUrl(url = "") {
|
||||
this.url = url;
|
||||
this.baseUrl = url.split("#")[0];
|
||||
let title = getPDFFileNameFromURL(url, "");
|
||||
let title = getPdfFilenameFromUrl(url, "");
|
||||
if (!title) {
|
||||
try {
|
||||
title = decodeURIComponent(getFilenameFromUrl(url)) || url;
|
||||
|
@ -772,7 +772,7 @@ const PDFViewerApplication = {
|
|||
get _docFilename() {
|
||||
// Use `this.url` instead of `this.baseUrl` to perform filename detection
|
||||
// based on the reference fragment as ultimate fallback if needed.
|
||||
return this._contentDispositionFilename || getPDFFileNameFromURL(this.url);
|
||||
return this._contentDispositionFilename || getPdfFilenameFromUrl(this.url);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue