Skip to content

Commit d9e2367

Browse files
committed
Merge pull request mozilla#2031 from gigaherz/url-decode-2
Gracefully fail if the URL filename cannot be decoded.
2 parents e0796ce + 1a91594 commit d9e2367

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

web/viewer.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,13 @@ var PDFView = {
385385

386386
setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {
387387
this.url = url;
388-
document.title = decodeURIComponent(getFileName(url)) || url;
388+
try {
389+
document.title = decodeURIComponent(getFileName(url)) || url;
390+
} catch (e) {
391+
// decodeURIComponent may throw URIError,
392+
// fall back to using the unprocessed url in that case
393+
document.title = url;
394+
}
389395
},
390396

391397
open: function pdfViewOpen(url, scale, password) {

0 commit comments

Comments
 (0)