forked from extern/bruno
Fixed an oversight when cloning from the parent
This commit is contained in:
parent
c018bfc044
commit
db1883536e
@ -319,8 +319,10 @@ export const cloneItem = (newName, itemUid, collectionUid) => (dispatch, getStat
|
||||
}
|
||||
|
||||
if (isItemAFolder(item)) {
|
||||
const parentFolder = findParentItemInCollection(collection, item.uid) || collection;
|
||||
|
||||
const folderWithSameNameExists = find(
|
||||
collection.items,
|
||||
parentFolder.items,
|
||||
(i) => i.type === 'folder' && trim(i.name) === trim(newName)
|
||||
);
|
||||
|
||||
@ -328,7 +330,7 @@ export const cloneItem = (newName, itemUid, collectionUid) => (dispatch, getStat
|
||||
return reject(new Error('Duplicate folder names under same parent folder are not allowed'));
|
||||
}
|
||||
|
||||
const collectionPath = `${collection.pathname}${PATH_SEPARATOR}${newName}`;
|
||||
const collectionPath = `${parentFolder.pathname}${PATH_SEPARATOR}${newName}`;
|
||||
ipcRenderer.invoke('renderer:clone-folder', item, collectionPath).then(resolve).catch(reject);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user