Merge pull request #2647 from akhilmhdh/fix/recursive

fix: resolved recursive secret logic pulling secret from top
This commit is contained in:
Maidul Islam
2024-10-25 10:11:53 -04:00
committed by GitHub
@@ -334,7 +334,8 @@ export const recursivelyGetSecretPaths = async ({
folderDAL, folderDAL,
projectEnvDAL, projectEnvDAL,
projectId, projectId,
environment environment,
currentPath
}: TRecursivelyFetchSecretsFromFoldersArg) => { }: TRecursivelyFetchSecretsFromFoldersArg) => {
const env = await projectEnvDAL.findOne({ const env = await projectEnvDAL.findOne({
projectId, projectId,
@@ -362,7 +363,11 @@ export const recursivelyGetSecretPaths = async ({
folderId: p.folderId folderId: p.folderId
})); }));
return paths; const pathsInCurrentDirectory = paths.filter((folder) =>
folder.path.startsWith(currentPath === "/" ? "" : currentPath)
);
return pathsInCurrentDirectory;
}; };
// used to convert multi line ones to quotes ones with \n // used to convert multi line ones to quotes ones with \n
const formatMultiValueEnv = (val?: string) => { const formatMultiValueEnv = (val?: string) => {