diff --git a/meshuser.js b/meshuser.js index 7e74e19a..ce9ab5d0 100644 --- a/meshuser.js +++ b/meshuser.js @@ -398,8 +398,15 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var sendUpdate = true, path = meshPathToRealPath(command.path, user); // This will also check access rights if (path == null) break; - if ((command.fileop == 'createfolder') && (obj.common.IsFilenameValid(command.newfolder) == true)) { try { obj.fs.mkdirSync(path + "/" + command.newfolder); } catch (e) { } } // Create a new folder - else if (command.fileop == 'delete') { // Delete + if ((command.fileop == 'createfolder') && (obj.common.IsFilenameValid(command.newfolder) == true)) { + // Create a new folder + try { obj.fs.mkdirSync(path + "/" + command.newfolder); } catch (e) { + try { obj.fs.mkdirSync(path); } catch (e) { } + try { obj.fs.mkdirSync(path + "/" + command.newfolder); } catch (e) { } + } + } + else if (command.fileop == 'delete') { + // Delete a file if (obj.common.validateArray(command.delfiles, 1) == false) return; for (i in command.delfiles) { if (obj.common.IsFilenameValid(command.delfiles[i]) == true) { @@ -412,16 +419,20 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } } - // If the entire mesh folder is empty, remove it. - // TODO: Should only check this when we deleted something in the mesh root folder. - try { - if (command.path[0].startsWith('mesh//')) { - path = meshPathToRealPath([command.path[0]], user); - obj.fs.readdir(path, function (err, dir) { if ((err == null) && (dir.length == 0)) { obj.fs.rmdir(path, function (err) { }); } }); - } - } catch (ex) { } + // If we deleted something in the mesh root folder and the entire mesh folder is empty, remove it. + if (command.path.length == 1) { + try { + if (command.path[0].startsWith('mesh//')) { + path = meshPathToRealPath([command.path[0]], user); + obj.fs.readdir(path, function (err, dir) { if ((err == null) && (dir.length == 0)) { obj.fs.rmdir(path, function (err) { }); } }); + } + } catch (ex) { } + } + } + else if ((command.fileop == 'rename') && (obj.common.IsFilenameValid(command.oldname) == true) && (obj.common.IsFilenameValid(command.newname) == true)) { + // Rename + try { obj.fs.renameSync(path + "/" + command.oldname, path + "/" + command.newname); } catch (e) { } } - else if ((command.fileop == 'rename') && (obj.common.IsFilenameValid(command.oldname) == true) && (obj.common.IsFilenameValid(command.newname) == true)) { try { obj.fs.renameSync(path + "/" + command.oldname, path + "/" + command.newname); } catch (e) { } } // Rename else if ((command.fileop == 'copy') || (command.fileop == 'move')) { if (obj.common.validateArray(command.names, 1) == false) return; var scpath = meshPathToRealPath(command.scpath, user); // This will also check access rights diff --git a/views/default-min.handlebars b/views/default-min.handlebars index 943f58d4..77c4fe79 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ - MeshCentral
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file + MeshCentral
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index 35f39172..f0a6100d 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2624,7 +2624,7 @@ function groupActionFunction() { var x = "Select an operation to perform on all selected devices. Actions will be performed only with proper rights.

"; - x += addHtmlValue('Operation', ''); + x += addHtmlValue('Operation', ''); setDialogMode(2, "Group Action", 3, groupActionFunctionEx, x); } diff --git a/views/login-min.handlebars b/views/login-min.handlebars index 59061708..bdfe4091 100644 --- a/views/login-min.handlebars +++ b/views/login-min.handlebars @@ -1 +1 @@ - MeshCentral - Login
{{{title}}}
{{{title2}}}

Welcome


\ No newline at end of file + MeshCentral - Login
{{{title}}}
{{{title2}}}

Welcome


\ No newline at end of file diff --git a/views/login-mobile-min.handlebars b/views/login-mobile-min.handlebars index 701a2512..f0c8f4ac 100644 --- a/views/login-mobile-min.handlebars +++ b/views/login-mobile-min.handlebars @@ -1 +1 @@ - MeshCentral - Login
{{{title}}}
{{{title2}}}
\ No newline at end of file + MeshCentral - Login
{{{title}}}
{{{title2}}}
\ No newline at end of file diff --git a/views/login-mobile.handlebars b/views/login-mobile.handlebars index a5074d14..90965802 100644 --- a/views/login-mobile.handlebars +++ b/views/login-mobile.handlebars @@ -73,7 +73,7 @@ -