Skip to content

Commit 1669b6e

Browse files
committed
Fixed "Assignment Branch Condition too high"
1 parent 0879634 commit 1669b6e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

baked_in.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,8 +1487,8 @@ func isHostname(fl FieldLevel) bool {
14871487
func isFQDN(fl FieldLevel) bool {
14881488
val := fl.Field().String()
14891489

1490-
if val[len(val)-1] == '.' && val[len(val)-2] != '.' {
1491-
val = strings.TrimRight(val, ".")
1490+
if val[len(val)-1] == '.' {
1491+
val = val[0 : len(val)-1]
14921492
}
14931493

14941494
return hostnameRegex.MatchString(val) &&

validator_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7182,6 +7182,7 @@ func TestFQDNValidation(t *testing.T) {
71827182
{"example24.com.", true},
71837183
{"test.example24.com.", true},
71847184
{"test24.example24.com.", true},
7185+
{"test24.example24.com..", false},
71857186
{"example", false},
71867187
{"192.168.0.1", false},
71877188
{"[email protected]", false},

0 commit comments

Comments
 (0)