Skip to content

Commit f16354e

Browse files
author
Dean Karn
committed
Add isdefault + fix fqdn
Closes #299 Fixes #306
1 parent 0d09605 commit f16354e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

baked_in.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,10 @@ func isHostname(fl FieldLevel) bool {
14941494
func isFQDN(fl FieldLevel) bool {
14951495
val := fl.Field().String()
14961496

1497+
if val == "" {
1498+
return false
1499+
}
1500+
14971501
if val[len(val)-1] == '.' {
14981502
val = val[0 : len(val)-1]
14991503
}

validator_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7189,6 +7189,7 @@ func TestFQDNValidation(t *testing.T) {
71897189
{"2001:cdba:0000:0000:0000:0000:3257:9652", false},
71907190
{"2001:cdba:0:0:0:0:3257:9652", false},
71917191
{"2001:cdba::3257:9652", false},
7192+
{"", false},
71927193
}
71937194

71947195
validate := New()

0 commit comments

Comments
 (0)