mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 09:28:06 +00:00
Merge pull request #1125 from akhilmhdh/fix/deep-main-page
fix: resolved nav header secret path issues
This commit is contained in:
@@ -131,7 +131,7 @@ export default function NavHeader({
|
|||||||
{isFolderMode &&
|
{isFolderMode &&
|
||||||
secretPathSegments?.map((folderName, index) => {
|
secretPathSegments?.map((folderName, index) => {
|
||||||
const query = { ...router.query };
|
const query = { ...router.query };
|
||||||
query.secretPath = secretPathSegments.slice(0, index + 1);
|
query.secretPath = `/${secretPathSegments.slice(0, index + 1).join("/")}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -111,23 +111,15 @@ export const SecretOverviewPage = () => {
|
|||||||
try {
|
try {
|
||||||
// create folder if not existing
|
// create folder if not existing
|
||||||
if (secretPath !== "/") {
|
if (secretPath !== "/") {
|
||||||
// /hello/world -> ["", "hello","world"]
|
// /hello/world -> [hello","world"]
|
||||||
const path = secretPath.split("/");
|
const pathSegment = secretPath.split("/").filter(Boolean);
|
||||||
// if its empty string on join use and OR gate to convert to /
|
const parentPath = `/${pathSegment.slice(0, -1).join("/")}`;
|
||||||
// /hello
|
const folderName = pathSegment.at(-1);
|
||||||
const directory =
|
if (folderName && parentPath) {
|
||||||
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) {
|
|
||||||
await createFolder({
|
await createFolder({
|
||||||
workspaceId,
|
workspaceId,
|
||||||
environment: env,
|
environment: env,
|
||||||
directory,
|
directory: parentPath,
|
||||||
folderName
|
folderName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user