From 482d6211aa4ca8e1d8a495b7f0af353ad62cb584 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 20 Jul 2024 10:19:45 +0200 Subject: [PATCH] Reduce a tiny bit of duplication in `PDFViewerApplication.setTitleUsingUrl` Rather than repeating code, we can always fallback to the raw URL instead. --- web/app.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/web/app.js b/web/app.js index 012cb3159..3f024ceab 100644 --- a/web/app.js +++ b/web/app.js @@ -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) {