chg: reverted to more strict file name pattern

This commit is contained in:
Tobi Schäfer 2020-05-31 22:21:07 +02:00
parent f64a1fa25d
commit 11639f9319
2 changed files with 3 additions and 6 deletions

View file

@ -65,11 +65,8 @@ File.remove = function() {
* @param {String} name
*/
File.getName = function(name) {
if (name) {
//return name.replace(/[^\w\d\s._-]/g, String.EMPTY);
return String(name).trim().replace(/[\/\\:;?+\[\]{}|#"`<>^]/g, String.EMPTY);
}
return null;
// TODO: Maybe return a hash if name is undefined?
return name ? String(name).replace(/[^\w\d\s,._-]/g, String.EMPTY) : null;
}
File.getGenericType = function (contentType) {

View file

@ -302,7 +302,7 @@ Image.prototype.update = function(data) {
File.prototype.setOrigin.call(this, origin);
if (!this.name) {
var name = File.getName(data.name) || mimeName.split('.')[0];
var name = File.getName(data.name || mimeName.split('.')[0]);
this.name = this.parent.images.getAccessName(name);
}