From aa1cef9e701b67a1c513895ccceac371043eae65 Mon Sep 17 00:00:00 2001 From: StonyTV Date: Wed, 22 Nov 2023 21:40:28 +0100 Subject: [PATCH] Fixed an oversight when cloning from the parent --- .../src/providers/ReduxStore/slices/collections/actions.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js index dd9ff945..9aa96146 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js @@ -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; }