Merge pull request #2203 from ether/setting-to-not-import-unknown-file-types

Allow for a setting so you can stop unknown file types from being imported
This commit is contained in:
John McLear 2014-11-15 15:41:08 +00:00
commit 3bf108f3b4
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){