Skip to content

Commit

Permalink
Add isdefault + fix fqdn
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Karn committed Sep 7, 2017
1 parent 0d09605 commit f16354e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions baked_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,10 @@ func isHostname(fl FieldLevel) bool {
func isFQDN(fl FieldLevel) bool {
val := fl.Field().String()

if val == "" {
return false
}

if val[len(val)-1] == '.' {
val = val[0 : len(val)-1]
}
Expand Down
1 change: 1 addition & 0 deletions validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7189,6 +7189,7 @@ func TestFQDNValidation(t *testing.T) {
{"2001:cdba:0000:0000:0000:0000:3257:9652", false},
{"2001:cdba:0:0:0:0:3257:9652", false},
{"2001:cdba::3257:9652", false},
{"", false},
}

validate := New()
Expand Down

0 comments on commit f16354e

Please sign in to comment.