@@ -50,8 +50,13 @@ const socialMediaLinksKinds = [
5050 schema: z
5151 .string ()
5252 .regex (/ ^ @? [a-zA-Z0-9 _] + $ / , " Invalid X handle." )
53- .min (3 , " X handles must be at least 3 characters long" )
54- .max (16 , " X handles cannot be longer than 16 characters" )
53+ .transform ((val ) => val .replace (/ ^ @/ , " " ))
54+ .pipe (
55+ z
56+ .string ()
57+ .min (3 , " X handles must be at least 3 characters long" )
58+ .max (15 , " X handles cannot be longer than 15 characters" ),
59+ )
5560 .optional (),
5661 toUrl : (input : string ) => ` https://x.com/${input .replace (/ ^ @/ , " " )} ` ,
5762 toDisplay : (input : string ) => ` @${input .replace (/ ^ @/ , " " )} ` ,
@@ -64,9 +69,14 @@ const socialMediaLinksKinds = [
6469 schema: z
6570 .string ()
6671 .regex (/ ^ @? [a-zA-Z0-9 -] + $ / , " Invalid GitHub username." )
67- .regex (/ --/ , " GitHub usernames cannot contain consecutive hyphens." )
68- .min (1 , " GitHub username cannot be empty" )
69- .max (39 , " GitHub usernames cannot be longer than 39 characters" )
72+ .regex (/ ^ (?!. * -{2,} )/ , " GitHub usernames cannot contain consecutive hyphens." )
73+ .transform ((v ) => v .replace (/ ^ @/ , " " ))
74+ .pipe (
75+ z
76+ .string ()
77+ .min (1 , " GitHub username cannot be empty" )
78+ .max (39 , " GitHub usernames cannot be longer than 39 characters" ),
79+ )
7080 .optional (),
7181 toUrl : (input : string ) => ` https://github.com/${input .replace (/ ^ @/ , " " )} ` ,
7282 toDisplay: id ,
@@ -78,7 +88,10 @@ const socialMediaLinksKinds = [
7888 icon: " mdi:linkedin" ,
7989 schema: z
8090 .url ()
81- .regex (/ ^ https? :\/\/ (www\. )? linkedin\. com\/ . * $ / , " Invalid LinkedIn URL." )
91+ .regex (
92+ / ^ https? :\/\/ (www\. )? linkedin\. com\/ (in| pub)\/ . * $ / ,
93+ " Invalid LinkedIn profile URL." ,
94+ )
8295 .optional (),
8396 toUrl : (input : string ) => new URL (input ).href ,
8497 toDisplay: id ,
@@ -91,7 +104,7 @@ const socialMediaLinksKinds = [
91104 schema: z
92105 .url ()
93106 .regex (
94- / ^ https? :\/\/ ( scholar\. google\. com | . * \. scholar \. google \. com) \/ . * $ / ,
107+ / ^ https? :\/\/ scholar\. google\. [ a-z . ] + \/ . * $ / ,
95108 " Invalid Google Scholar URL." ,
96109 )
97110 .optional (),
0 commit comments