From 1d5fdf35ec828a775221f2bd93519307607b9fb9 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 19 Aug 2019 22:28:52 +0200 Subject: [PATCH] # in pdf name not working --- static/js/document.js | 2 +- static/js/documentDialog.js | 2 +- static/js/utils.js | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/static/js/document.js b/static/js/document.js index 6d1b2567..a13332d2 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 a8d1d581..b2c17308 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 7f80064d..3ce86c15 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') {