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, ""); let title = getPdfFilenameFromUrl(url, "");
if (!title) { if (!title) {
try { try {
title = decodeURIComponent(getFilenameFromUrl(url)) || url; title = decodeURIComponent(getFilenameFromUrl(url));
} catch { } catch {
// decodeURIComponent may throw URIError, // decodeURIComponent may throw URIError.
// fall back to using the unprocessed url in that case
title = url;
} }
} }
this.setTitle(title); this.setTitle(title || url); // Always fallback to the raw URL.
}, },
setTitle(title = this._title) { setTitle(title = this._title) {