mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-11 00:28:49 +00:00
fix: resolved nav header secret path issues
This commit is contained in:
@@ -111,23 +111,15 @@ export const SecretOverviewPage = () => {
|
||||
try {
|
||||
// create folder if not existing
|
||||
if (secretPath !== "/") {
|
||||
// /hello/world -> ["", "hello","world"]
|
||||
const path = secretPath.split("/");
|
||||
// if its empty string on join use and OR gate to convert to /
|
||||
// /hello
|
||||
const directory =
|
||||
path
|
||||
.slice(0, -1)
|
||||
.reduce(
|
||||
(prev, curr, index, arr) => prev + (index + 1 === arr.length ? curr : `/${curr}`),
|
||||
""
|
||||
) || "/";
|
||||
const folderName = path.at(-1); // world
|
||||
if (folderName && directory) {
|
||||
// /hello/world -> [hello","world"]
|
||||
const pathSegment = secretPath.split("/").filter(Boolean);
|
||||
const parentPath = `/${pathSegment.slice(0, -1).join("/")}`;
|
||||
const folderName = pathSegment.at(-1);
|
||||
if (folderName && parentPath) {
|
||||
await createFolder({
|
||||
workspaceId,
|
||||
environment: env,
|
||||
directory,
|
||||
directory: parentPath,
|
||||
folderName
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user