diff --git a/src/app/dashboard/[subdomain]/editor/page.tsx b/src/app/dashboard/[subdomain]/editor/page.tsx index 9ba368c4..1a3535ba 100644 --- a/src/app/dashboard/[subdomain]/editor/page.tsx +++ b/src/app/dashboard/[subdomain]/editor/page.tsx @@ -181,12 +181,13 @@ export default function SubdomainEditor() { ) } if (key === "slug" && !/^[a-zA-Z0-9\-_]*$/.test(value as string)) { + // Replace all invalid chars + ;(value as string) = (value as string).replace(/[^\w\-]/g, "-") toast.error( t( "Slug can only contain letters, numbers, hyphens, and underscores.", ), ) - return } const newValues = { ...values, [key]: value } if (draftKey) {