Skip to content

Open-source status page, incident response and uptime monitoring

fix: slug (#94)

Maximilian Kaske0019e5826541
diff --git a/packages/db/src/schema/page.ts b/packages/db/src/schema/page.ts
index f071d9a55..b1752ec08 100644
--- a/packages/db/src/schema/page.ts
+++ b/packages/db/src/schema/page.ts
@@ -41,7 +41,13 @@ export const pageRelations = relations(page, ({ many, one }) => ({
// Schema for inserting a Page - can be used to validate API requests
export const insertPageSchema = createInsertSchema(page, {
customDomain: z.string().optional(),
- slug: z.string().min(3), // minimum subdomain length
+ slug: z
+ .string()
+ .regex(
+ new RegExp("^[A-Za-z0-9-]+$"),
+ "Only use digits (0-9), hyphen (-) or characters (A-Z, a-z).",
+ )
+ .min(3),
});
export const insertPageSchemaWithMonitors = insertPageSchema.extend({