[geary] Allow email address with "localhost" as the domain part. Fixes Bug 714299.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Allow email address with "localhost" as the domain part. Fixes Bug 714299.
- Date: Mon, 4 Dec 2017 05:42:39 +0000 (UTC)
commit b6980a2f37720e0e82060ffb84ac5335dbdfe9c2
Author: Michael James Gratton <mike vee net>
Date: Mon Dec 4 16:41:54 2017 +1100
Allow email address with "localhost" as the domain part. Fixes Bug 714299.
src/engine/rfc822/rfc822-mailbox-address.vala | 2 +-
test/engine/rfc822-mailbox-address-test.vala | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/engine/rfc822/rfc822-mailbox-address.vala b/src/engine/rfc822/rfc822-mailbox-address.vala
index 1c3af97..5b46792 100644
--- a/src/engine/rfc822/rfc822-mailbox-address.vala
+++ b/src/engine/rfc822/rfc822-mailbox-address.vala
@@ -162,7 +162,7 @@ public class Geary.RFC822.MailboxAddress : Geary.MessageData.SearchableMessageDa
// http://www.regular-expressions.info/email.html
// matches john dep aol.museum not john aol com
Regex email_regex =
- new Regex("[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,5}",
+ new Regex("[A-Z0-9._%+-]+@((?:[A-Z0-9-]+\\.)+[A-Z]{2}|localhost)",
RegexCompileFlags.CASELESS);
return email_regex.match(address);
} catch (RegexError e) {
diff --git a/test/engine/rfc822-mailbox-address-test.vala b/test/engine/rfc822-mailbox-address-test.vala
index 938e31f..b06b263 100644
--- a/test/engine/rfc822-mailbox-address-test.vala
+++ b/test/engine/rfc822-mailbox-address-test.vala
@@ -15,10 +15,12 @@ class Geary.RFC822.MailboxAddressTest : Gee.TestCase {
public void is_valid_address() {
assert(Geary.RFC822.MailboxAddress.is_valid_address("john dep aol.museum") == true);
assert(Geary.RFC822.MailboxAddress.is_valid_address("test example com") == true);
- // This is Bug 714299
- //assert(Geary.RFC822.MailboxAddress.is_valid_address("test@example") == true);
+ assert(Geary.RFC822.MailboxAddress.is_valid_address("test other example com") == true);
+ assert(Geary.RFC822.MailboxAddress.is_valid_address("test@localhost") == true);
+ assert(Geary.RFC822.MailboxAddress.is_valid_address("test2@localhost") == true);
assert(Geary.RFC822.MailboxAddress.is_valid_address("some context test example com text") == true);
+ assert(Geary.RFC822.MailboxAddress.is_valid_address("test@example") == false);
assert(Geary.RFC822.MailboxAddress.is_valid_address("john aol com") == false);
assert(Geary.RFC822.MailboxAddress.is_valid_address("@example.com") == false);
assert(Geary.RFC822.MailboxAddress.is_valid_address("@example") == false);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]