diff --git a/static/js/document.js b/static/js/document.js index 6d1b2567c..a13332d20 100644 --- a/static/js/document.js +++ b/static/js/document.js @@ -66,7 +66,7 @@ pandora.ui.document = function() { ? pandora.user.ui.documents[item.id].position : 1, url: '/documents/' + item.id + '/' - + item.title.replace('?', '_') + '.' + item.extension, + + pandora.safePDFName(item.title + '.' + item.extension), width: that.width(), zoom: 'fit' }) diff --git a/static/js/documentDialog.js b/static/js/documentDialog.js index a8d1d581f..b2c173082 100644 --- a/static/js/documentDialog.js +++ b/static/js/documentDialog.js @@ -196,7 +196,7 @@ pandora.ui.documentDialog = function(options) { ? pandora.user.ui.documents[item.id].position : 1, url: '/documents/' + item.id + '/' - + item.title.replace('?', '_') + '.' + item.extension, + + pandora.safePDFName(item.title + '.' + item.extension), width: dialogWidth, zoom: 'fit' }) diff --git a/static/js/utils.js b/static/js/utils.js index 7f80064d5..3ce86c15a 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -2625,6 +2625,11 @@ pandora.openURL = function(url) { } }; +pandora.safePDFName = function(name) { + name = name.replace('?', '_').replace('#', '_'); + return name; +}; + pandora.saveURL = function(url, name) { var link = document.createElement('a'); if (typeof link.download === 'string') {