Skip to content

Commit

Permalink
Merge pull request #38 from Kefaku/slugfix
Browse files Browse the repository at this point in the history
update slug error messages
  • Loading branch information
HoodieRocks authored Jan 18, 2024
2 parents bad149e + 277c01c commit 2620ffb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/routes/projects/new/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ const newProjectSchema = z.object({
icon: z.ostring(),
url: z
.string()
.regex(/^[1-9a-z]+(-[1-9a-z]+)*$/, {
message: "Slug can only contain alphanumeric characters and hyphens!"
.regex(/^-*[1-9a-z]+(-[1-9a-z]+)*$/, {
message: "Slug can only contain lower case alphanumeric characters and hyphens!"
})
.regex(/^-/, {
message: "Slug may not start with a hyphen!"
})
.min(1, { message: "Slug is empty!" })
.max(35, { message: "Slug too long!" }),
title: z.string().max(35, { message: "Title too long!" }),
description: z.string().min(3).max(200, { message: "Summary too long!" }),
Expand Down

0 comments on commit 2620ffb

Please sign in to comment.