Let filemanager/vfs handle escaping characters instead of just stripping them out

This commit is contained in:
Nathan Gray 2015-03-18 16:20:11 +00:00
parent 18442ff3e5
commit 97efc7808c
2 changed files with 8 additions and 3 deletions

View File

@ -169,6 +169,11 @@ class filemanager_select
$files = $content['path'];
break;
case 'saveas':
// Don't trust the name the user gives, encode it
$content['name'] = egw_vfs::encodePathComponent($content['name']);
// Fall through
default:
$files = egw_vfs::concat($content['path'],$content['name']);
break;

View File

@ -2579,7 +2579,7 @@ app.classes.mail = AppJS.extend(
url += 'menuaction=filemanager.filemanager_select.select'; // todo compose for Draft folder
url += '&mode=saveas';
var subject = dataElem? dataElem.data.subject: _elems[0].subject;
var filename = subject.replace(/[\f\n\t\v/\\:*#?<>\|]/g,"_")|| 'unknown';
var filename = subject.replace(/[\f\n\t\v]/g,"_")|| 'unknown';
url += '&name='+encodeURIComponent(filename+'.eml');
url += '&mime=message'+encodeURIComponent('/')+'rfc822';
url += '&method=mail.mail_ui.vfsSaveMessage';