From 010e5271eac3a121890210f38dad6b59d29599e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vest=C3=B8l?= Date: Tue, 19 Jun 2018 23:58:56 +0200 Subject: [PATCH] Might have fixed bug related to mod uploads --- master.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/master.js b/master.js index f7ccc5e9..311f2088 100644 --- a/master.js +++ b/master.js @@ -415,10 +415,7 @@ POST endpoint for uploading mods to the master server. Required for automatic mo app.post("/api/uploadMod", authenticate.middleware, function(req,res) { endpointHitCounter.labels(req.route.path).inc(); let reqStartTime = Date.now(); - if (!req.files) { - res.send('No files were uploaded.'); - return; - } else { + if (req.files && req.files.file) { console.log(req.files.file); req.files.file.mv('./database/masterMods/'+req.files.file.name, function(err) { if (err) { @@ -429,7 +426,10 @@ app.post("/api/uploadMod", authenticate.middleware, function(req,res) { } httpRequestDurationMilliseconds.labels(req.route.path).observe(Date.now()-reqStartTime); }); - } + } else { + res.send('No files were uploaded.'); + return; + } }); /** GET endpoint for getting information about all our slaves