Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix: added empty string as default for tag color and added regex to resolve issue with multiple spacing in tag names.

Ebezer Igbinoba9fa28f5b5e14
diff --git a/frontend/src/hooks/api/tags/queries.tsx b/frontend/src/hooks/api/tags/queries.tsx
index 517eb93540..7c230e02a8 100644
--- a/frontend/src/hooks/api/tags/queries.tsx
+++ b/frontend/src/hooks/api/tags/queries.tsx
@@ -38,7 +38,7 @@ export const useCreateWsTag = () => {
mutationFn: async ({ workspaceID, tagName, tagColor, tagSlug }) => {
const { data } = await apiRequest.post(`/api/v2/workspace/${workspaceID}/tags`, {
name: tagName,
- tagColor: tagColor || null,
+ tagColor: tagColor || "",
slug: tagSlug
})
return data;
diff --git a/frontend/src/hooks/api/tags/types.ts b/frontend/src/hooks/api/tags/types.ts
index 9d3129886f..de09f5ac47 100644
--- a/frontend/src/hooks/api/tags/types.ts
+++ b/frontend/src/hooks/api/tags/types.ts
@@ -17,7 +17,7 @@ export type CreateTagDTO = {
workspaceID: string;
tagSlug: string;
tagName: string;
- tagColor: string | null;
+ tagColor: string;
};
export type CreateTagRes = {
diff --git a/frontend/src/views/Settings/ProjectSettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx b/frontend/src/views/Settings/ProjectSettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx
index 2a349229ef..ca395423bd 100644
--- a/frontend/src/views/Settings/ProjectSettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx
+++ b/frontend/src/views/Settings/ProjectSettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx
@@ -53,8 +53,8 @@ export const AddSecretTagModal = ({
await createWsTag.mutateAsync({
workspaceID: currentWorkspace?._id,
tagName: name,
- tagSlug: name.replace(" ", "_"),
- tagColor: null
+ tagSlug: name.replace(/\s+/g, " ").replace(" ", "_"),
+ tagColor: ""
});
handlePopUpClose("CreateSecretTag");
@@ -63,6 +63,7 @@ export const AddSecretTagModal = ({
text: "Successfully created a tag",
type: "success"
});
+ reset()
} catch (err) {
console.error(err);
createNotification({