mirror of
https://github.com/Infisical/infisical.git
synced 2026-05-02 03:02:03 -04:00
fix: resolved nav header secret path issues
This commit is contained in:
@@ -131,7 +131,7 @@ export default function NavHeader({
|
||||
{isFolderMode &&
|
||||
secretPathSegments?.map((folderName, index) => {
|
||||
const query = { ...router.query };
|
||||
query.secretPath = secretPathSegments.slice(0, index + 1);
|
||||
query.secretPath = `/${secretPathSegments.slice(0, index + 1).join("/")}`;
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -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