diff --git a/web/app.js b/web/app.js index 012cb3159db34..3f024ceab82a2 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) {