Merge pull request #2031 from gigaherz/url-decode-2

Gracefully fail if the URL filename cannot be decoded.
This commit is contained in:
Yury Delendik 2012-08-27 05:38:04 -07:00
commit d9e2367c75

View File

@ -385,7 +385,13 @@ var PDFView = {
setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) { setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {
this.url = url; this.url = url;
document.title = decodeURIComponent(getFileName(url)) || url; try {
document.title = decodeURIComponent(getFileName(url)) || url;
} catch (e) {
// decodeURIComponent may throw URIError,
// fall back to using the unprocessed url in that case
document.title = url;
}
}, },
open: function pdfViewOpen(url, scale, password) { open: function pdfViewOpen(url, scale, password) {