From c75845413436f76fda18f74b0c76616bc2584409 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Mon, 25 Jun 2018 18:08:41 -0600 Subject: [PATCH] Fix empty filename check --- core/upload.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/upload.js b/core/upload.js index 7dd5dd51..a2f2c9ea 100644 --- a/core/upload.js +++ b/core/upload.js @@ -92,16 +92,16 @@ exports.getModule = class UploadModule extends MenuModule { // validation validateNonBlindFileName : (fileName, cb) => { - fileName = sanatizeFilename(fileName); // remove unsafe chars, path info, etc. - if(0 === fileName.length) { - return cb(new Error('Invalid filename')); - } - if(0 === fileName.length) { return cb(new Error('Filename cannot be empty')); } - // At least SEXYZ doesn't like non-blind names that start with a number - it becomes confused + fileName = sanatizeFilename(fileName); // remove unsafe chars, path info, etc. + if(0 === fileName.length) { // sanatize nuked everything? + return cb(new Error('Invalid filename')); + } + + // At least SEXYZ doesn't like non-blind names that start with a number - it becomes confused ;-( if(/^[0-9].*$/.test(fileName)) { return cb(new Error('Invalid filename')); }