From 8e222189bc0966ce8f0a6ef7099e29b657e555fb Mon Sep 17 00:00:00 2001 From: Pragadesh-45 <54320162+Pragadesh-45@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:07:45 +0530 Subject: [PATCH] Bugfix/rename with same name (#3171) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix rename with same name with different case * added `_temp` to the filename to change the request name (handle case insensitivity) on Win and macOS * chore: remove whitespaces and added path added path resolver * refactor: wslpath check * feat: safeToRename check added * refactor * refactor: code cleanup * chore: improved error message --------- Co-authored-by: Linhart Lukáš Co-authored-by: Anoop M D --- .../RenameCollectionItem/index.js | 7 +++-- .../ReduxStore/slices/collections/actions.js | 3 +- packages/bruno-electron/src/ipc/collection.js | 15 ++++++---- .../bruno-electron/src/utils/filesystem.js | 30 +++++++++++++++++-- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RenameCollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RenameCollectionItem/index.js index 5711cdbcd..6cf8cb21a 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RenameCollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RenameCollectionItem/index.js @@ -28,9 +28,12 @@ const RenameCollectionItem = ({ collection, item, onClose }) => { if (!isFolder && item.draft) { await dispatch(saveRequest(item.uid, collection.uid, true)); } + if (item.name === values.name) { + return; + } dispatch(renameItem(values.name, item.uid, collection.uid)) .then(() => { - toast.success('Request renamed!'); + toast.success('Request renamed'); onClose(); }) .catch((err) => { @@ -55,7 +58,7 @@ const RenameCollectionItem = ({ collection, item, onClose }) => { handleConfirm={onSubmit} handleCancel={onClose} > -
e.preventDefault()}> + e.preventDefault()}>