mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
ImportHandler: early return by condition inversion
No functional changes
This commit is contained in:
parent
6727a77073
commit
395db73eb1
1 changed files with 19 additions and 17 deletions
|
@ -132,27 +132,29 @@ exports.doImport = function(req, res, padId)
|
||||||
},
|
},
|
||||||
function(callback) {
|
function(callback) {
|
||||||
var fileEnding = path.extname(srcFile).toLowerCase()
|
var fileEnding = path.extname(srcFile).toLowerCase()
|
||||||
var fileIsEtherpad = (fileEnding === ".etherpad");
|
var fileIsNotEtherpad = (fileEnding !== ".etherpad");
|
||||||
|
|
||||||
if(fileIsEtherpad){
|
if (fileIsNotEtherpad) {
|
||||||
// we do this here so we can see if the pad has quit ea few edits
|
callback();
|
||||||
padManager.getPad(padId, function(err, _pad){
|
|
||||||
var headCount = _pad.head;
|
|
||||||
if(headCount >= 10){
|
|
||||||
apiLogger.warn("Direct database Import attempt of a pad that already has content, we wont be doing this")
|
|
||||||
return callback("padHasData");
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.readFile(srcFile, "utf8", function(err, _text){
|
return;
|
||||||
directDatabaseAccess = true;
|
}
|
||||||
importEtherpad.setPadRaw(padId, _text, function(err){
|
|
||||||
callback();
|
// we do this here so we can see if the pad has quit ea few edits
|
||||||
});
|
padManager.getPad(padId, function(err, _pad){
|
||||||
|
var headCount = _pad.head;
|
||||||
|
if(headCount >= 10){
|
||||||
|
apiLogger.warn("Direct database Import attempt of a pad that already has content, we wont be doing this")
|
||||||
|
return callback("padHasData");
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.readFile(srcFile, "utf8", function(err, _text){
|
||||||
|
directDatabaseAccess = true;
|
||||||
|
importEtherpad.setPadRaw(padId, _text, function(err){
|
||||||
|
callback();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}else{
|
});
|
||||||
callback();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
//convert file to html
|
//convert file to html
|
||||||
function(callback) {
|
function(callback) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue