Support to allow for a setting so you can stop unknown file types from being imported

This commit is contained in:
John McLear 2014-07-22 15:46:31 +01:00
parent 9d1eca42b3
commit 17f26b8c2c
3 changed files with 20 additions and 7 deletions

View file

@ -92,9 +92,14 @@ exports.doImport = function(req, res, padId)
}
//we need to rename this file with a .txt ending
else {
var oldSrcFile = srcFile;
srcFile = path.join(path.dirname(srcFile),path.basename(srcFile, fileEnding)+".txt");
fs.rename(oldSrcFile, srcFile, callback);
if(settings.allowUnknownFileEnds === true){
var oldSrcFile = srcFile;
srcFile = path.join(path.dirname(srcFile),path.basename(srcFile, fileEnding)+".txt");
fs.rename(oldSrcFile, srcFile, callback);
}else{
console.warn("Not allowing unknown file type to be imported", fileEnding);
callback("uploadFailed");
}
}
},
function(callback){