fix: hostname regex (#4255)

This commit is contained in:
Piyush Gupta
2024-11-11 11:21:39 +05:30
committed by GitHub
parent 2ff1be2c4a
commit f650ac4e76

View File

@@ -1041,7 +1041,7 @@ export const ZSurvey = z
if (question.type === TSurveyQuestionTypeEnum.Cal) {
if (question.calHost !== undefined) {
const hostnameRegex = /^[a-zA-Z0-9]+(?<domain>\.[a-zA-Z0-9]+)+$/;
const hostnameRegex = /^(?!-)[a-zA-Z0-9-]{1,63}(?<!-)(?:\.(?!-)[a-zA-Z0-9-]{1,63}(?<!-)){1,}$/i;
if (!hostnameRegex.test(question.calHost)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,