From 49a7572cee4e8a1ff53d4d34c6dfe52d668e884c Mon Sep 17 00:00:00 2001 From: muxator Date: Wed, 31 Oct 2018 23:28:52 +0100 Subject: [PATCH] ImportHandler: early return by condition inversion No functional changes --- src/node/handler/ImportHandler.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 04febbf0a..d8e1e7cd7 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -285,20 +285,22 @@ exports.doImport = function(req, res, padId) //clean up temporary files function(callback) { - if(!directDatabaseAccess){ - //for node < 0.7 compatible - var fileExists = fs.exists || path.exists; - async.parallel([ - function(callback){ - fileExists (srcFile, function(exist) { (exist)? fs.unlink(srcFile, callback): callback(); }); - }, - function(callback){ - fileExists (destFile, function(exist) { (exist)? fs.unlink(destFile, callback): callback(); }); - } - ], callback); - }else{ + if (directDatabaseAccess) { callback(); + + return; } + + //for node < 0.7 compatible + var fileExists = fs.exists || path.exists; + async.parallel([ + function(callback){ + fileExists (srcFile, function(exist) { (exist)? fs.unlink(srcFile, callback): callback(); }); + }, + function(callback){ + fileExists (destFile, function(exist) { (exist)? fs.unlink(destFile, callback): callback(); }); + } + ], callback); } ], function(err) { var status = "ok";