create folder first before copy/move #5704
Simon Smith committed
Jan 31, 2024 at 15:02 UTC
4648dbeb26fef0ba8393fae4d9f3e18f67607cca
1 file changed
+1
meshuser.js
+1
@@ -906,6 +906,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
906
if (common.IsFilenameValid(command.names[i]) === true) {
907
var s = parent.path.join(scpath, command.names[i]), d = parent.path.join(path, command.names[i]);
908
sendUpdate = false;
909
+ try { fs.mkdirSync(path); } catch (ex) { } // try to create folder first incase folder is missing
910
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));
911
}
912
}