Merge pull request #18464 from Snuffleupagus/setTitleUsingUrl-url-fallback

Reduce a tiny bit of duplication in `PDFViewerApplication.setTitleUsingUrl`
This commit is contained in:
Tim van der Meij 2024-07-20 18:04:47 +02:00 committed by GitHub
commit 9db1ae4da5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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) {