feat: switch to simpler email address parsing

This stops the psl insanity and matches more closely what the c-core did

Closes #325
This commit is contained in:
dignifiedquire
2019-08-13 12:54:09 +02:00
committed by holger krekel
parent 8342b29618
commit dab514d8bc
5 changed files with 95 additions and 95 deletions

View File

@@ -909,20 +909,7 @@ pub fn get_first_name<'a>(full_name: &'a str) -> &'a str {
/// Returns false if addr is an invalid address, otherwise true.
pub fn may_be_valid_addr(addr: &str) -> bool {
if addr.is_empty() {
return false;
}
let at = addr.find('@').unwrap_or_default();
if at < 1 {
return false;
}
let dot = addr.find('.').unwrap_or_default();
if dot < 1 || dot > addr.len() - 3 || dot < at + 2 {
return false;
}
true
addr.parse::<EmailAddress>().is_ok()
}
pub fn addr_normalize(addr: &str) -> &str {