Skip to content

Commit

Permalink
Reduce a tiny bit of duplication in `PDFViewerApplication.setTitleUsi…
Browse files Browse the repository at this point in the history
…ngUrl`

Rather than repeating code, we can always fallback to the raw URL instead.
  • Loading branch information
Snuffleupagus committed Jul 20, 2024
1 parent ed83d7c commit 482d621
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 482d621

Please sign in to comment.