Fix empty filename check

This commit is contained in:
Bryan Ashby 2018-06-25 18:08:41 -06:00
parent 3aa23db306
commit c758454134
1 changed files with 6 additions and 6 deletions

View File

@ -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'));
}