fix: secret path / with a new env causes secret list to be empty

This commit is contained in:
Akhil Mohan
2023-08-08 12:18:21 +05:30
parent ec21e35f8c
commit 97a0728f02
2 changed files with 10 additions and 2 deletions

View File

@@ -697,10 +697,16 @@ export const getSecrets = async (req: Request, res: Response) => {
const environment = req.query.environment as string;
const folders = await Folder.findOne({ workspace: workspaceId, environment });
if ((!folders && folderId && folderId !== "root") || (!folders && secretPath)) {
if (
// if no folders and asking for a non root folder id or non root secret path
(!folders && folderId && folderId !== "root") ||
(!folders && secretPath && secretPath !== "/")
) {
res.send({ secrets: [] });
return;
}
if (folders && folderId !== "root") {
const folder = searchByFolderId(folders.nodes, folderId as string);
if (!folder) {

View File

@@ -115,7 +115,9 @@ export const SecretDropzone = ({
workspaceId,
env: selectedEnvSlug,
secretPath: debouncedSecretPath,
isPaused: !(Boolean(workspaceId) && Boolean(selectedEnvSlug) && Boolean(debouncedSecretPath)),
isPaused:
!(Boolean(workspaceId) && Boolean(selectedEnvSlug) && Boolean(debouncedSecretPath)) &&
!popUp.importSecEnv.isOpen,
decryptFileKey
});