mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Merge pull request #18464 from Snuffleupagus/setTitleUsingUrl-url-fallback
Reduce a tiny bit of duplication in `PDFViewerApplication.setTitleUsingUrl`
This commit is contained in:
commit
9db1ae4da5
1 changed files with 3 additions and 5 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue