Fix automatically renaming of same name folders in copyFromOtherDrive function

This commit is contained in:
DianaXWiki 2026-01-28 13:35:32 +02:00
parent 53eab89c8a
commit b6401aa0c2
3 changed files with 13 additions and 3 deletions

View File

@ -541,7 +541,7 @@ const factory = (UserObject, Util, Hash,
if (copy) { return; }
if (resolved.main.length) {
if (resolved.main.length && !moveError) {
// Remove the elements from the old location (without unpinning)
Env.user.userObject.delete(resolved.main, waitFor()); // FIXME waitFor() is called synchronously
}
@ -580,7 +580,9 @@ const factory = (UserObject, Util, Hash,
if (copy) { return; }
// Remove the elements from the old location (without unpinning)
uoFrom.delete(paths, waitFor()); // FIXME waitFor() is called synchronously
if (!moveError) {
uoFrom.delete(paths, waitFor()); // FIXME waitFor() is called synchronously
}
}
});
}

View File

@ -314,6 +314,14 @@ const factory = (Util, Hash, Realtime) => {
// Copy file or folder
var newParent = exp.find(path);
var tempName = exp.isFile(element) ? Hash.createChannelId() : key;
if (exp.isFolder(element) && tempName !== Messages.fm_newFolder &&
typeof(newParent[tempName]) !== "undefined") {
throw {
error: 'E_DUPLICATE_FOLDER_NAME',
folderName: tempName,
message: Messages.fo_unavailableName
};
}
var newName = exp.getAvailableName(newParent, tempName);
if (Array.isArray(newParent)) {
newParent.push(element);

File diff suppressed because one or more lines are too long