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:
parent
ed83d7c5e1
commit
482d6211aa
@ -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) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user