fix: #57 fix domain validator must be required problem

This commit is contained in:
moonrailgun 2024-04-26 00:14:25 +08:00
parent 1e05a273a0
commit 5767d4595b

View File

@ -19,6 +19,11 @@ export const hostnameValidator: Validator = (rule, value, callback) => {
export const domainValidator: Validator = (rule, value, callback) => {
try {
if (!rule.required && !value) {
callback();
return;
}
z.string().regex(hostnameRegex).parse(value);
callback();
} catch (err) {