diff --git a/pkg/s3utils/utils.go b/pkg/s3utils/utils.go index 6de0a45aa3..9af2997b74 100644 --- a/pkg/s3utils/utils.go +++ b/pkg/s3utils/utils.go @@ -47,8 +47,8 @@ func IsValidDomain(host string) bool { if host[len(host)-1:] == "_" || host[:1] == "_" { return false } - // host cannot start or end with a "." - if host[len(host)-1:] == "." || host[:1] == "." { + // host cannot start with a "." + if host[:1] == "." { return false } // All non alphanumeric characters are invalid. diff --git a/pkg/s3utils/utils_test.go b/pkg/s3utils/utils_test.go index 322b619329..587b5cd324 100644 --- a/pkg/s3utils/utils_test.go +++ b/pkg/s3utils/utils_test.go @@ -99,6 +99,7 @@ func TestIsValidDomain(t *testing.T) { {"s3.amz.test.com", true}, {"s3.%%", false}, {"localhost", true}, + {"localhost.", true}, // http://www.dns-sd.org/trailingdotsindomainnames.html {"-localhost", false}, {"", false}, {"\n \t", false},