From 11639f931945890e9ab19b2fae27dd0f070fcc90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sun, 31 May 2020 22:21:07 +0200 Subject: [PATCH] chg: reverted to more strict file name pattern --- code/File/File.js | 7 ++----- code/Image/Image.js | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/code/File/File.js b/code/File/File.js index 4753f877..9b20a27d 100644 --- a/code/File/File.js +++ b/code/File/File.js @@ -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) { diff --git a/code/Image/Image.js b/code/Image/Image.js index ba0ec1f0..800c9f60 100644 --- a/code/Image/Image.js +++ b/code/Image/Image.js @@ -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); }