mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-11 09:28:52 +00:00
fix: returns error on duplicate folder creation
This commit is contained in:
@@ -118,24 +118,11 @@ export const secretFolderServiceFactory = ({
|
||||
});
|
||||
}
|
||||
|
||||
// check if the exact folder already exists
|
||||
const existingFolder = await folderDAL.findOne(
|
||||
{
|
||||
envId: env.id,
|
||||
parentId: parentFolder.id,
|
||||
name,
|
||||
isReserved: false
|
||||
},
|
||||
tx
|
||||
);
|
||||
|
||||
if (existingFolder) {
|
||||
return existingFolder;
|
||||
}
|
||||
|
||||
// exact folder case
|
||||
if (parentFolder.path === pathWithFolder) {
|
||||
return parentFolder;
|
||||
throw new BadRequestError({
|
||||
message: `Folder with name '${name}' already exists in path '${secretPath}'`
|
||||
});
|
||||
}
|
||||
|
||||
let currentParentId = parentFolder.id;
|
||||
|
||||
Reference in New Issue
Block a user