File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ export const CreateLinkSchema = z.object({
15
15
. url ( {
16
16
message : "Please enter a valid URL. Include http:// or https://" ,
17
17
} )
18
+ . regex ( / ^ (? ! .* (?: h t t p | h t t p s ) : \/ \/ (?: s l u g | s l u g r ) \. v e r c e l \. a p p ) .* $ / , {
19
+ message : "You cannot redirect to the Slug url." ,
20
+ } )
21
+ // not contain any blank spaces
18
22
. regex ( / ^ \S + $ / , {
19
23
message : "URL must not contain any blank spaces." ,
20
24
} ) ,
@@ -39,7 +43,16 @@ export const CreateLinkSchema = z.object({
39
43
40
44
export const EditLinkSchema = z . object ( {
41
45
id : z . string ( ) ,
42
- url : z . string ( ) . min ( 1 , { message : "URL is required." } ) ,
46
+ url : z
47
+ . string ( )
48
+ . min ( 1 , { message : "URL is required." } )
49
+ . regex ( / ^ (? ! .* (?: h t t p | h t t p s ) : \/ \/ (?: s l u g | s l u g r ) \. v e r c e l \. a p p ) .* $ / , {
50
+ message : "You cannot redirect to the Slug url." ,
51
+ } )
52
+ // not contain any blank spaces
53
+ . regex ( / ^ \S + $ / , {
54
+ message : "URL must not contain any blank spaces." ,
55
+ } ) ,
43
56
slug : z
44
57
. string ( )
45
58
. min ( 1 , { message : "Short link is required." } )
You can’t perform that action at this time.
0 commit comments