From f4ec041372e1dd4839106124b241f7b4a9aa0b15 Mon Sep 17 00:00:00 2001 From: favonia Date: Sun, 17 Oct 2021 22:21:43 -0500 Subject: [PATCH] fix(api): remove all trailing dots (#95) Current it only removes one trailing dot. --- internal/api/fqdn.go | 2 +- internal/api/fqdn_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/api/fqdn.go b/internal/api/fqdn.go index 7a68d190..759167a3 100644 --- a/internal/api/fqdn.go +++ b/internal/api/fqdn.go @@ -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 } diff --git a/internal/api/fqdn_test.go b/internal/api/fqdn_test.go index a51d4fca..2d7e0b70 100644 --- a/internal/api/fqdn_test.go +++ b/internal/api/fqdn_test.go @@ -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