1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Reduce a tiny bit of duplication in PDFViewerApplication.setTitleUsingUrl

Rather than repeating code, we can always fallback to the raw URL instead.
This commit is contained in:
Jonas Jenwald 2024-07-20 10:19:45 +02:00
parent ed83d7c5e1
commit 482d6211aa

View file

@ -859,14 +859,12 @@ const PDFViewerApplication = {
let title = getPdfFilenameFromUrl(url, "");
if (!title) {
try {
title = decodeURIComponent(getFilenameFromUrl(url)) || url;
title = decodeURIComponent(getFilenameFromUrl(url));
} catch {
// decodeURIComponent may throw URIError,
// fall back to using the unprocessed url in that case
title = url;
// decodeURIComponent may throw URIError.
}
}
this.setTitle(title);
this.setTitle(title || url); // Always fallback to the raw URL.
},
setTitle(title = this._title) {