Skip to content

Commit

Permalink
fix(api): remove all trailing dots (#95)
Browse files Browse the repository at this point in the history
Current it only removes one trailing dot.
  • Loading branch information
favonia authored Oct 18, 2021
1 parent 342b7e8 commit f4ec041
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/api/fqdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewFQDN(domain string) (FQDN, error) {
normalized, err := profile.ToASCII(domain)

// Remove the final dot for consistency
normalized = strings.TrimSuffix(normalized, ".")
normalized = strings.TrimRight(normalized, ".")

return FQDN(normalized), err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/api/fqdn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestNewFQDN(t *testing.T) {
{"نامه\u200Cای.de", "xn--mgba3gch31f060k.de", true, ""},
// some other test cases
{"xn--a.xn--a.xn--a.com", "xn--a.xn--a.xn--a.com", false, "idna: invalid label \"\\u0080\""},
{"a.com...。", "a.com...", true, ""},
{"a.com...。", "a.com", true, ""},
{"..。..a.com", "a.com", true, ""},
} {
tc := tc
Expand Down

0 comments on commit f4ec041

Please sign in to comment.