mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 13:27:46 +00:00
Merge pull request #834 from akhilmhdh/fix/copy-sec-not-populating
fix: secret path / with a new env causes secret list to be empty
This commit is contained in:
@@ -785,10 +785,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) {
|
||||
|
||||
Reference in New Issue
Block a user