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:
parent
ed83d7c5e1
commit
482d6211aa
1 changed files with 3 additions and 5 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue