melib/email/parser: ack \ as an atom

I think this is not spec compliant but the MIME spec (rfc6068 - The
'mailto' URI Scheme) uses it for "valid" addresses.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/333/head
Manos Pitsidianakis 5 months ago
parent f685726eac
commit 933bf157ae
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -368,16 +368,19 @@ mod tests {
// Email address: "oh\\no"@example.org; corresponding 'mailto' URI:
// <mailto:%22oh%5C%5Cno%22@example.org>.
assert_eq!(
mlt!("mailto:%22not%40me%22@example.org").address,
vec![addr!(r#""not@me"@example.org"#)]
);
// Email address: "\\\"it's\ ugly\\\""@example.org; corresponding
// 'mailto' URI:
// <mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org>.
// [ref:FIXME]
//assert_eq!(
// mlt!("mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org").
// address, vec![addr!(r#"\"it's ugly\"@example.org"#)]
//);
assert_eq!(
mlt!("mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org").address,
vec![addr!(r#""\\\"it's\ ugly\\\""@example.org"#)]
);
// When an email address itself includes an "&" (ampersand) character, that
// character has to be percent-encoded. For example, the 'mailto' URI

@ -1413,7 +1413,7 @@ pub mod generic {
if input[0].is_ascii_alphanumeric()
|| [
b'!', b'#', b'$', b'%', b'&', b'\'', b'*', b'+', b'-', b'/', b'=', b'?', b'^',
b'_', b'`', b'{', b'|', b'}', b'~',
b'_', b'`', b'{', b'|', b'}', b'~', b'\\',
]
.contains(&input[0])
{

Loading…
Cancel
Save