melib/email/parser: ack \ as an atom
Run cargo lints / Lint on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 9m31s Details
Cargo manifest lints / Lint Cargo manifests on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 14m5s Details
Run Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 15m24s Details

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 2023-12-26 00:49:59 +02:00
parent f685726eac
commit 933bf157ae
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
2 changed files with 9 additions and 6 deletions

View File

@ -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

View File

@ -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])
{