Fixed multi-device batch upload.

This commit is contained in:
Ylian Saint-Hilaire 2020-12-21 23:55:26 -08:00
parent 3dc616151a
commit 317a8ac8d7
2 changed files with 3 additions and 4 deletions

View File

@ -175,7 +175,7 @@
"welcomePicture": { "type": "string", "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." },
"hide": { "type": "integer", "default": 0 },
"footer": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." },
"loginfooter": { "type": "string", "default": null "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." },
"loginfooter": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." },
"certUrl": {
"type": "string",
"format": "uri",

View File

@ -3274,7 +3274,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
function handleUploadFileBatch(req, res) {
const domain = checkUserIpAddress(req, res);
if (domain == null) { return; }
if (domain.userQuota == -1) { res.sendStatus(401); return; }
var authUserid = null;
if ((req.session != null) && (typeof req.session.userid == 'string')) { authUserid = req.session.userid; }
const multiparty = require('multiparty');
@ -3290,7 +3289,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
// Get the user
const user = obj.users[authUserid];
if ((user == null) || (user.siteadmin & 8) == 0) { res.sendStatus(401); return; } // Check if we have file rights
if (user == null) { parent.debug('web', 'Batch upload error, invalid user.'); res.sendStatus(401); return; } // Check if user exists
// Get fields
if ((fields == null) || (fields.nodeIds == null) || (fields.nodeIds.length != 1)) { res.sendStatus(404); return; }
@ -3300,7 +3299,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if ((fields.overwriteFiles != null) && (fields.overwriteFiles.length == 1) && (fields.overwriteFiles[0] == 'on')) { cmd.overwrite = true; }
if ((fields.createFolder != null) && (fields.createFolder.length == 1) && (fields.createFolder[0] == 'on')) { cmd.createFolder = true; }
// Check if we have al least one target path
// Check if we have at least one target path
if ((cmd.windowsPath == null) && (cmd.linuxPath == null)) {
parent.debug('web', 'Batch upload error, invalid fields: ' + JSON.stringify(fields));
res.send('');