mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-13 11:31:50 +00:00
Fixed issue with server files.
This commit is contained in:
parent
0269db277f
commit
f080df2547
1 changed files with 7 additions and 4 deletions
|
@ -734,21 +734,24 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((command.fileop == 'rename') && (common.IsFilenameValid(command.oldname) == true) && (common.IsFilenameValid(command.newname) == true)) {
|
else if ((command.fileop == 'rename') && (common.IsFilenameValid(command.oldname) === true) && (common.IsFilenameValid(command.newname) === true)) {
|
||||||
// Rename
|
// Rename
|
||||||
try { fs.renameSync(path + '/' + command.oldname, path + '/' + command.newname); } catch (e) { }
|
try { fs.renameSync(path + '/' + command.oldname, path + '/' + command.newname); } catch (e) { }
|
||||||
}
|
}
|
||||||
else if ((command.fileop == 'copy') || (command.fileop == 'move')) {
|
else if ((command.fileop == 'copy') || (command.fileop == 'move')) {
|
||||||
|
// Copy or move of one or many files
|
||||||
if (common.validateArray(command.names, 1) == false) return;
|
if (common.validateArray(command.names, 1) == false) return;
|
||||||
var scpath = meshPathToRealPath(command.scpath, user); // This will also check access rights
|
var scpath = meshPathToRealPath(command.scpath, user); // This will also check access rights
|
||||||
if (scpath == null) break;
|
if (scpath == null) break;
|
||||||
// TODO: Check quota if this is a copy!!!!!!!!!!!!!!!!
|
// TODO: Check quota if this is a copy!!!!!!!!!!!!!!!!
|
||||||
for (i in command.names) {
|
for (i in command.names) {
|
||||||
|
if (common.IsFilenameValid(command.names[i]) === true) {
|
||||||
var s = parent.path.join(scpath, command.names[i]), d = parent.path.join(path, command.names[i]);
|
var s = parent.path.join(scpath, command.names[i]), d = parent.path.join(path, command.names[i]);
|
||||||
sendUpdate = false;
|
sendUpdate = false;
|
||||||
copyFile(s, d, function (op) { if (op != null) { fs.unlink(op, function (err) { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); }); } else { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } }, ((command.fileop == 'move') ? s : null));
|
copyFile(s, d, function (op) { if (op != null) { fs.unlink(op, function (err) { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); }); } else { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } }, ((command.fileop == 'move') ? s : null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sendUpdate == true) { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } // Fire an event causing this user to update this files
|
if (sendUpdate == true) { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } // Fire an event causing this user to update this files
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue