working for all files
This commit is contained in:
parent
1081156f13
commit
ab5e7381a2
|
@ -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,24 +157,28 @@ exports.doImport = function(req, res, padId)
|
||||||
},
|
},
|
||||||
|
|
||||||
function(callback) {
|
function(callback) {
|
||||||
if (!abiword || !directDatabaseAccess) {
|
if (!abiword){
|
||||||
// Read the file with no encoding for raw buffer access.
|
if(!directDatabaseAccess) {
|
||||||
fs.readFile(destFile, function(err, buf) {
|
// Read the file with no encoding for raw buffer access.
|
||||||
if (err) throw err;
|
fs.readFile(destFile, function(err, buf) {
|
||||||
var isAscii = true;
|
if (err) throw err;
|
||||||
// Check if there are only ascii chars in the uploaded file
|
var isAscii = true;
|
||||||
for (var i=0, len=buf.length; i<len; i++) {
|
// Check if there are only ascii chars in the uploaded file
|
||||||
if (buf[i] > 240) {
|
for (var i=0, len=buf.length; i<len; i++) {
|
||||||
isAscii=false;
|
if (buf[i] > 240) {
|
||||||
break;
|
isAscii=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (isAscii) {
|
||||||
if (isAscii) {
|
callback();
|
||||||
callback();
|
} else {
|
||||||
} else {
|
callback("uploadFailed");
|
||||||
callback("uploadFailed");
|
}
|
||||||
}
|
});
|
||||||
});
|
}else{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue