From 8b86973a82706e83acae45c58f70475af7c3cb9d Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Mon, 31 Aug 2015 15:48:39 -0700 Subject: [PATCH] fix(regex): allow "=" in valid email address Fixes T3440 Email formatting validation bug --- spec-nylas/stores/contact-store-spec.coffee | 1 + src/regexp-utils.coffee | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spec-nylas/stores/contact-store-spec.coffee b/spec-nylas/stores/contact-store-spec.coffee index f11ff835c..492e058f7 100644 --- a/spec-nylas/stores/contact-store-spec.coffee +++ b/spec-nylas/stores/contact-store-spec.coffee @@ -98,6 +98,7 @@ describe "ContactStore", -> "spang \"Christine Spang\" ": [new Contact(name: "spang \"Christine Spang\"", email: "noreply+phabricator@nilas.com")] "Evan (evan@nylas.com)": [new Contact(name: "Evan", email: "evan@nylas.com")] "\"Michael\" (mg@nylas.com)": [new Contact(name: "Michael", email: "mg@nylas.com")] + "announce-uc.1440659566.kankcagcmaacemjlnoma-security=nylas.com@lists.openwall.com": [new Contact(name: "announce-uc.1440659566.kankcagcmaacemjlnoma-security=nylas.com@lists.openwall.com", email: "announce-uc.1440659566.kankcagcmaacemjlnoma-security=nylas.com@lists.openwall.com")] # Multiple contact test cases "Evan Morikawa , Ben ": [ diff --git a/src/regexp-utils.coffee b/src/regexp-utils.coffee index ce621c570..2d28500df 100644 --- a/src/regexp-utils.coffee +++ b/src/regexp-utils.coffee @@ -7,7 +7,7 @@ RegExpUtils = # It's also imporant we return a fresh copy of the RegExp every time. A # javascript regex is stateful and multiple functions using this method # will cause unexpected behavior! - emailRegex: -> new RegExp(/([a-z.A-Z0-9%+_-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})/g) + emailRegex: -> new RegExp(/([a-z.A-Z0-9%+=_-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})/g) # https://regex101.com/r/zG7aW4/3 imageTagRegex: -> /]*src="([^"]*)"[^>]*>/g