working for all files

This commit is contained in:
John McLear 2014-12-29 21:35:10 +01:00
parent 1081156f13
commit ab5e7381a2
1 changed files with 24 additions and 20 deletions

View File

@ -125,10 +125,11 @@ exports.doImport = function(req, res, padId)
fs.readFile(srcFile, "utf8", function(err, _text){ fs.readFile(srcFile, "utf8", function(err, _text){
directDatabaseAccess = true; directDatabaseAccess = true;
importEtherpad.setPadRaw(padId, _text, function(err){ importEtherpad.setPadRaw(padId, _text, function(err){
console.log("returning"); callback();
return callback(null);
}); });
}); });
}else{
callback();
} }
}, },
//convert file to html //convert file to html
@ -156,7 +157,8 @@ exports.doImport = function(req, res, padId)
}, },
function(callback) { function(callback) {
if (!abiword || !directDatabaseAccess) { if (!abiword){
if(!directDatabaseAccess) {
// Read the file with no encoding for raw buffer access. // Read the file with no encoding for raw buffer access.
fs.readFile(destFile, function(err, buf) { fs.readFile(destFile, function(err, buf) {
if (err) throw err; if (err) throw err;
@ -177,6 +179,9 @@ exports.doImport = function(req, res, padId)
}else{ }else{
callback(); callback();
} }
} else {
callback();
}
}, },
//get the pad object //get the pad object
@ -256,7 +261,6 @@ exports.doImport = function(req, res, padId)
} }
} }
], function(err) { ], function(err) {
var status = "ok"; var status = "ok";
//check for known errors and replace the status //check for known errors and replace the status