From 4c2ad68b69b31e0254b006fb26d03775ea5b7488 Mon Sep 17 00:00:00 2001 From: muxator Date: Wed, 31 Oct 2018 23:20:55 +0100 Subject: [PATCH] ImportHandler: early return via DeMorgan's law Inverted a boolean condition, no functional changes. --- src/node/handler/ImportHandler.js | 40 ++++++++++++++++--------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 17aea05af..16823a366 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -188,27 +188,29 @@ exports.doImport = function(req, res, padId) }, function(callback) { - if (!useConvertor && !directDatabaseAccess){ - // Read the file with no encoding for raw buffer access. - fs.readFile(destFile, function(err, buf) { - if (err) throw err; - var isAscii = true; - // Check if there are only ascii chars in the uploaded file - for (var i=0, len=buf.length; i 240) { - isAscii=false; - break; - } - } - if (isAscii) { - callback(); - } else { - callback("uploadFailed"); - } - }); - } else { + if (useConvertor || directDatabaseAccess) { callback(); + + return; } + + // Read the file with no encoding for raw buffer access. + fs.readFile(destFile, function(err, buf) { + if (err) throw err; + var isAscii = true; + // Check if there are only ascii chars in the uploaded file + for (var i=0, len=buf.length; i 240) { + isAscii=false; + break; + } + } + if (isAscii) { + callback(); + } else { + callback("uploadFailed"); + } + }); }, //get the pad object