mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Merge pull request #1124 from akhilmhdh/fix/folder-create-overview
fix:resolved overview page add secret not working when folder not exist in one level deep
This commit is contained in:
@@ -111,9 +111,18 @@ export const SecretOverviewPage = () => {
|
|||||||
try {
|
try {
|
||||||
// create folder if not existing
|
// create folder if not existing
|
||||||
if (secretPath !== "/") {
|
if (secretPath !== "/") {
|
||||||
|
// /hello/world -> ["", "hello","world"]
|
||||||
const path = secretPath.split("/");
|
const path = secretPath.split("/");
|
||||||
const directory = path.slice(0, -1).join("/");
|
// if its empty string on join use and OR gate to convert to /
|
||||||
const folderName = path.at(-1);
|
// /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) {
|
if (folderName && directory) {
|
||||||
await createFolder({
|
await createFolder({
|
||||||
workspaceId,
|
workspaceId,
|
||||||
|
|||||||
Reference in New Issue
Block a user