Skip to content

Commit 2c3ca81

Browse files
committed
move check after the empty-suffix handling
1 parent 9ac5f5c commit 2c3ca81

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

iana/iana.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ func ExtractSuffix(name string) (string, error) {
2424

2525
suffix := rule.Decompose(name)[1]
2626

27-
if !zlintutil.IsInTLDMap(suffix) {
28-
return "", fmt.Errorf("Domain %s has an unknown TLD %s", name, suffix)
29-
}
30-
3127
// If the TLD is empty, it means name is actually a suffix.
3228
// In fact, decompose returns an array of empty strings in this case.
3329
if suffix == "" {
3430
suffix = name
3531
}
3632

33+
if !zlintutil.IsInTLDMap(suffix) {
34+
return "", fmt.Errorf("Domain %s has an unknown TLD %s", name, suffix)
35+
}
36+
3737
return suffix, nil
3838
}

0 commit comments

Comments
 (0)