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:
Jonas Jenwald 2021-03-16 11:56:31 +01:00
parent a164941351
commit bd9dee1544
8 changed files with 225 additions and 226 deletions

View file

@ -13,8 +13,7 @@
* limitations under the License.
*/
import { getPDFFileNameFromURL } from "./ui_utils.js";
import { loadScript } from "pdfjs-lib";
import { getPdfFilenameFromUrl, loadScript } from "pdfjs-lib";
async function docPropertiesLookup(pdfDocument) {
const url = "",
@ -37,7 +36,7 @@ async function docPropertiesLookup(pdfDocument) {
...info,
baseURL: baseUrl,
filesize: contentLength,
filename: contentDispositionFilename || getPDFFileNameFromURL(url),
filename: contentDispositionFilename || getPdfFilenameFromUrl(url),
metadata: metadata?.getRaw(),
authors: metadata?.get("dc:creator"),
numPages: pdfDocument.numPages,