# in pdf name not working

This commit is contained in:
j 2019-08-19 22:28:52 +02:00
parent c5d481ee78
commit 1d5fdf35ec
3 changed files with 7 additions and 2 deletions

View file

@ -66,7 +66,7 @@ pandora.ui.document = function() {
? pandora.user.ui.documents[item.id].position ? pandora.user.ui.documents[item.id].position
: 1, : 1,
url: '/documents/' + item.id + '/' url: '/documents/' + item.id + '/'
+ item.title.replace('?', '_') + '.' + item.extension, + pandora.safePDFName(item.title + '.' + item.extension),
width: that.width(), width: that.width(),
zoom: 'fit' zoom: 'fit'
}) })

View file

@ -196,7 +196,7 @@ pandora.ui.documentDialog = function(options) {
? pandora.user.ui.documents[item.id].position ? pandora.user.ui.documents[item.id].position
: 1, : 1,
url: '/documents/' + item.id + '/' url: '/documents/' + item.id + '/'
+ item.title.replace('?', '_') + '.' + item.extension, + pandora.safePDFName(item.title + '.' + item.extension),
width: dialogWidth, width: dialogWidth,
zoom: 'fit' zoom: 'fit'
}) })

View file

@ -2625,6 +2625,11 @@ pandora.openURL = function(url) {
} }
}; };
pandora.safePDFName = function(name) {
name = name.replace('?', '_').replace('#', '_');
return name;
};
pandora.saveURL = function(url, name) { pandora.saveURL = function(url, name) {
var link = document.createElement('a'); var link = document.createElement('a');
if (typeof link.download === 'string') { if (typeof link.download === 'string') {