From 2be2a549ca7efb8d52e03f6427f65d1ac44adc20 Mon Sep 17 00:00:00 2001 From: Dan Couture Date: Thu, 27 Aug 2020 03:14:11 -0400 Subject: [PATCH] catch the case where an non-email is provided (#152) --- gsuite/utils.go | 1 + gsuite/utils_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/gsuite/utils.go b/gsuite/utils.go index 8ab957c1..4445032c 100644 --- a/gsuite/utils.go +++ b/gsuite/utils.go @@ -187,6 +187,7 @@ func validateEmail(v interface{}, k string) (warnings []string, errors []error) if err != nil { errors = append(errors, fmt.Errorf("unable to parse email address %s", email)) + return } if e.Name != "" { diff --git a/gsuite/utils_test.go b/gsuite/utils_test.go index 0a8e042b..c9415bce 100644 --- a/gsuite/utils_test.go +++ b/gsuite/utils_test.go @@ -14,6 +14,7 @@ func TestValidateEmail(t *testing.T) { {"Alice ", false}, {"much-much-much-much-much-much-much-much-much-much-much-much-too-long@domain.com", false}, {"\"some@much-much-much-much-much-much-much-much-much-much-much-much-too-long\"@domain.com", false}, + {"not an email address", false}, } for _, testCase := range testCases {