workaround when multiple at encountered

This commit is contained in:
Quentin 2023-06-18 22:48:54 +02:00
parent 5083abb835
commit cad1ca9978
Signed by: quentin
GPG key ID: E9602264D639FF68

View file

@ -87,8 +87,8 @@ fn obs_domain_list_rest(input: &str) -> IResult<&str, Vec<String>> {
/// so I force obsolete for now...
pub fn addr_spec(input: &str) -> IResult<&str, AddrSpec> {
map(
tuple((obs_local_part, tag("@"), obs_domain)),
|(local_part, _, domain)|
tuple((obs_local_part, tag("@"), obs_domain, many0(pair(tag("@"), obs_domain)))),
|(local_part, _, domain, _)|
AddrSpec { local_part, domain },
)(input)
}
@ -315,4 +315,19 @@ mod tests {
}))
);
}
#[test]
fn test_enron4() {
assert_eq!(
mailbox(r#"<"mark_kopinski/intl/acim/americancentury"@americancentury.com@enron.com>"#),
Ok(("", MailboxRef {
name: None,
addrspec: AddrSpec {
local_part: "mark_kopinski/intl/acim/americancentury".into(),
domain: "americancentury.com".into(),
}
}))
);
}
}