Support to allow for a setting so you can stop unknown file types from being imported
parent
9d1eca42b3
commit
17f26b8c2c
|
@ -75,6 +75,9 @@
|
||||||
Abiword is needed to advanced import/export features of pads*/
|
Abiword is needed to advanced import/export features of pads*/
|
||||||
"abiword" : null,
|
"abiword" : null,
|
||||||
|
|
||||||
|
/* Should we allow of file types other than the supported types: .html, .txt, .doc, .docx, .rtf, .ods */
|
||||||
|
"allowUnknownFileEnds" : true,
|
||||||
|
|
||||||
/* This setting is used if you require authentication of all users.
|
/* This setting is used if you require authentication of all users.
|
||||||
Note: /admin always requires authentication. */
|
Note: /admin always requires authentication. */
|
||||||
"requireAuthentication" : false,
|
"requireAuthentication" : false,
|
||||||
|
|
|
@ -92,9 +92,14 @@ exports.doImport = function(req, res, padId)
|
||||||
}
|
}
|
||||||
//we need to rename this file with a .txt ending
|
//we need to rename this file with a .txt ending
|
||||||
else {
|
else {
|
||||||
|
if(settings.allowUnknownFileEnds === true){
|
||||||
var oldSrcFile = srcFile;
|
var oldSrcFile = srcFile;
|
||||||
srcFile = path.join(path.dirname(srcFile),path.basename(srcFile, fileEnding)+".txt");
|
srcFile = path.join(path.dirname(srcFile),path.basename(srcFile, fileEnding)+".txt");
|
||||||
fs.rename(oldSrcFile, srcFile, callback);
|
fs.rename(oldSrcFile, srcFile, callback);
|
||||||
|
}else{
|
||||||
|
console.warn("Not allowing unknown file type to be imported", fileEnding);
|
||||||
|
callback("uploadFailed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(callback){
|
function(callback){
|
||||||
|
|
|
@ -129,6 +129,11 @@ exports.minify = true;
|
||||||
*/
|
*/
|
||||||
exports.abiword = null;
|
exports.abiword = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should we support none natively supported file types on import?
|
||||||
|
*/
|
||||||
|
exports.allowUnknownFileEnds = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The log level of log4js
|
* The log level of log4js
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue