Fixed multi-device batch upload.
Ylian Saint-Hilaire committed
Dec 21, 2020 at 23:55 UTC
317a8ac8d75cf503807e5f354aa65a02ef5adac1
2 files changed
+3
-4
meshcentral-config-schema.json
+1
-1
@@ -175,7 +175,7 @@
175
"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." },
176
"hide": { "type": "integer", "default": 0 },
177
"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." },
178
- "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." },
178
+ "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." },
179
"certUrl": {
180
"type": "string",
181
"format": "uri",
webserver.js
+2
-3
@@ -3274,7 +3274,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3274
function handleUploadFileBatch(req, res) {
3275
const domain = checkUserIpAddress(req, res);
3276
if (domain == null) { return; }
3277
- if (domain.userQuota == -1) { res.sendStatus(401); return; }
3277
var authUserid = null;
3278
if ((req.session != null) && (typeof req.session.userid == 'string')) { authUserid = req.session.userid; }
3279
const multiparty = require('multiparty');
@@ -3290,7 +3289,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3289
3290
// Get the user
3291
const user = obj.users[authUserid];
3293
- if ((user == null) || (user.siteadmin & 8) == 0) { res.sendStatus(401); return; } // Check if we have file rights
3292
+ if (user == null) { parent.debug('web', 'Batch upload error, invalid user.'); res.sendStatus(401); return; } // Check if user exists
3293
3294
// Get fields
3295
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) {
3299
if ((fields.overwriteFiles != null) && (fields.overwriteFiles.length == 1) && (fields.overwriteFiles[0] == 'on')) { cmd.overwrite = true; }
3300
if ((fields.createFolder != null) && (fields.createFolder.length == 1) && (fields.createFolder[0] == 'on')) { cmd.createFolder = true; }
3301
3303
- // Check if we have al least one target path
3302
+ // Check if we have at least one target path
3303
if ((cmd.windowsPath == null) && (cmd.linuxPath == null)) {
3304
parent.debug('web', 'Batch upload error, invalid fields: ' + JSON.stringify(fields));
3305
res.send('');