mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 05:29:33 +00:00
adjustment: standardized slug validation
This commit is contained in:
@@ -166,7 +166,7 @@ export default function SecretReferenceSelect({
|
||||
})}
|
||||
|
||||
{listReference.length !== 0 && (
|
||||
<SelectPrimitive.Separator className="m-1 h-[1px] mb-2 bg-mineshaft-400" />
|
||||
<SelectPrimitive.Separator className="m-1 mb-2 h-[1px] bg-mineshaft-400" />
|
||||
)}
|
||||
</SelectPrimitive.Group>
|
||||
|
||||
|
||||
+9
-1
@@ -1,5 +1,6 @@
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import slugify from "@sindresorhus/slugify";
|
||||
import * as yup from "yup";
|
||||
|
||||
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||
@@ -16,7 +17,14 @@ type Props = {
|
||||
|
||||
const schema = yup.object({
|
||||
environmentName: yup.string().label("Environment Name").required(),
|
||||
environmentSlug: yup.string().label("Environment Slug").matches(/^[^./]*$/g, { message: "Invalid [.] or [/] not allowed"}).required()
|
||||
environmentSlug: yup
|
||||
.string()
|
||||
.label("Environment Slug")
|
||||
.test({
|
||||
test: (slug) => slugify(slug as string) === slug,
|
||||
message: "Slug must be a valid slug"
|
||||
})
|
||||
.required()
|
||||
});
|
||||
|
||||
export type FormData = yup.InferType<typeof schema>;
|
||||
|
||||
Reference in New Issue
Block a user