From 195b41cb79e44479f066825cabca31f336dc4373 Mon Sep 17 00:00:00 2001 From: Azareal Date: Fri, 19 Jun 2020 14:22:41 +1000 Subject: [PATCH] stop suspicious email check breaking optional emails --- common/utils.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/utils.go b/common/utils.go index 6501a09b..4a814a21 100644 --- a/common/utils.go +++ b/common/utils.go @@ -341,6 +341,9 @@ func NameToSlug(name string) (slug string) { // TODO: Write a test for this func HasSuspiciousEmail(email string) bool { + if email == "" { + return false + } lowEmail := strings.ToLower(email) // TODO: Use a more flexible blacklist, perhaps with a similar mechanism to the HTML tag registration system in PreparseMessage() if !strings.Contains(lowEmail, "@") || strings.Contains(lowEmail, "casino") || strings.Contains(lowEmail, "viagra") || strings.Contains(lowEmail, "pharma") || strings.Contains(lowEmail, "pill") { @@ -381,7 +384,6 @@ func unmarshalJsonFileIgnore404(name string, in interface{}) error { return json.Unmarshal(data, in) } -// TODO: Write a test for this func CanonEmail(email string) string { email = strings.ToLower(email)