Fixed issue with server files.
Ylian Saint-Hilaire committed
Jun 21, 2020 at 13:59 UTC
1c10b9c0232512b98e9c1dac1d900a02c3054c5a
1 file changed
+7
-4
meshuser.js
+7
-4
@@ -734,19 +734,22 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
734
} catch (ex) { }
735
}
736
}
737
- else if ((command.fileop == 'rename') && (common.IsFilenameValid(command.oldname) == true) && (common.IsFilenameValid(command.newname) == true)) {
737
+ else if ((command.fileop == 'rename') && (common.IsFilenameValid(command.oldname) === true) && (common.IsFilenameValid(command.newname) === true)) {
738
// Rename
739
try { fs.renameSync(path + '/' + command.oldname, path + '/' + command.newname); } catch (e) { }
740
}
741
else if ((command.fileop == 'copy') || (command.fileop == 'move')) {
742
+ // Copy or move of one or many files
743
if (common.validateArray(command.names, 1) == false) return;
744
var scpath = meshPathToRealPath(command.scpath, user); // This will also check access rights
745
if (scpath == null) break;
746
// TODO: Check quota if this is a copy!!!!!!!!!!!!!!!!
747
for (i in command.names) {
747
- var s = parent.path.join(scpath, command.names[i]), d = parent.path.join(path, command.names[i]);
748
- sendUpdate = false;
749
- 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));
748
+ if (common.IsFilenameValid(command.names[i]) === true) {
749
+ var s = parent.path.join(scpath, command.names[i]), d = parent.path.join(path, command.names[i]);
750
+ sendUpdate = false;
751
+ 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));
752
+ }
753
}
754
}
755