mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
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 <anoop.md1421@gmail.com>
This commit is contained in:
parent
25f43f12c7
commit
2e4051b022
@ -22,6 +22,9 @@ const RenameEnvironment = ({ onClose, environment, collection }) => {
|
|||||||
.required('name is required')
|
.required('name is required')
|
||||||
}),
|
}),
|
||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
|
if (values.name === environment.name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
dispatch(renameEnvironment(values.name, environment.uid, collection.uid))
|
dispatch(renameEnvironment(values.name, environment.uid, collection.uid))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toast.success('Environment renamed successfully');
|
toast.success('Environment renamed successfully');
|
||||||
|
@ -298,7 +298,7 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newEnvFilePath = path.join(envDirPath, `${newName}.bru`);
|
const newEnvFilePath = path.join(envDirPath, `${newName}.bru`);
|
||||||
if (fs.existsSync(newEnvFilePath)) {
|
if (!safeToRename(envFilePath, newEnvFilePath)) {
|
||||||
throw new Error(`environment: ${newEnvFilePath} already exists`);
|
throw new Error(`environment: ${newEnvFilePath} already exists`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user