Skip to content

Commit

Permalink
feat(ui): Tighten action form title regex constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
daryllimyt committed Apr 23, 2024
1 parent 676336c commit fae7375
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/src/components/workspace/panel/action/schemas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,16 @@ const OpenCaseActionSchema = z.object({
suppression: z.array(suppressionSchema).default([]),
tags: z.array(tagSchema).default([]),
})

const BASE_ACTION_SCHEMA_REGEX = /^[a-zA-Z0-9_]+$/
export const baseActionSchema = z.object({
title: z.string().min(1, { message: "Title cannot be empty" }),
title: z
.string()
.min(1, { message: "Title cannot be empty" })
.regex(BASE_ACTION_SCHEMA_REGEX, {
message:
"Title can only include alphanumeric characters, spaces, and underscores",
}),
description: z.string(),
})
export type BaseActionForm = z.infer<typeof baseActionSchema>
Expand Down

0 comments on commit fae7375

Please sign in to comment.