Skip to content

Commit 2e4051b

Browse files
Bugfix/rename with same name for Environments (#3199)
* added safe to rename for rename-environment to enable case insensitive file change * chore: removed else block --------- Co-authored-by: Anoop M D <[email protected]>
1 parent 25f43f1 commit 2e4051b

File tree

2 files changed

+4
-1
lines changed
  • packages
    • bruno-app/src/components/Environments/EnvironmentSettings/RenameEnvironment
    • bruno-electron/src/ipc

2 files changed

+4
-1
lines changed

packages/bruno-app/src/components/Environments/EnvironmentSettings/RenameEnvironment/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ const RenameEnvironment = ({ onClose, environment, collection }) => {
2222
.required('name is required')
2323
}),
2424
onSubmit: (values) => {
25+
if (values.name === environment.name) {
26+
return;
27+
}
2528
dispatch(renameEnvironment(values.name, environment.uid, collection.uid))
2629
.then(() => {
2730
toast.success('Environment renamed successfully');

packages/bruno-electron/src/ipc/collection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
298298
}
299299

300300
const newEnvFilePath = path.join(envDirPath, `${newName}.bru`);
301-
if (fs.existsSync(newEnvFilePath)) {
301+
if (!safeToRename(envFilePath, newEnvFilePath)) {
302302
throw new Error(`environment: ${newEnvFilePath} already exists`);
303303
}
304304

0 commit comments

Comments
 (0)