Commit b6980a2f authored by Michael Gratton's avatar Michael Gratton 🤞

Allow email address with "localhost" as the domain part. Fixes Bug 714299.

parent 735c5308
......@@ -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) {
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment