mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Update rust-email, test that no empty lines are produced (#2119)
* Add a failing test for #2118 * Update rust-email to fix #2118
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1274,7 +1274,7 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||
[[package]]
|
||||
name = "email"
|
||||
version = "0.0.21"
|
||||
source = "git+https://github.com/deltachat/rust-email?branch=master#9161f2d45d29ae8f0119fde0facdb1b0d7c6f077"
|
||||
source = "git+https://github.com/deltachat/rust-email?branch=master#25702df99254d059483b41417cd80696a258df8e"
|
||||
dependencies = [
|
||||
"base64 0.11.0",
|
||||
"chrono",
|
||||
|
||||
@@ -1618,4 +1618,56 @@ mod tests {
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_empty_lines_in_header() {
|
||||
// See https://github.com/deltachat/deltachat-core-rust/issues/2118
|
||||
let to_tuples = [
|
||||
("Nnnn", "nnn@ttttttttt.de"),
|
||||
("😀 ttttttt", "ttttttt@rrrrrr.net"),
|
||||
("dididididididi", "t@iiiiiii.org"),
|
||||
("Ttttttt", "oooooooooo@abcd.de"),
|
||||
("Mmmmm", "mmmmm@rrrrrr.net"),
|
||||
("Zzzzzz", "rrrrrrrrrrrrr@ttttttttt.net"),
|
||||
("Xyz", "qqqqqqqqqq@rrrrrr.net"),
|
||||
("", "geug@ttttttttt.de"),
|
||||
("qqqqqq", "q@iiiiiii.org"),
|
||||
("bbbb", "bbbb@iiiiiii.org"),
|
||||
("", "fsfs@iiiiiii.org"),
|
||||
("rqrqrqrqr", "rqrqr@iiiiiii.org"),
|
||||
("tttttttt", "tttttttt@iiiiiii.org"),
|
||||
("", "tttttt@rrrrrr.net"),
|
||||
]
|
||||
.iter();
|
||||
let to: Vec<_> = to_tuples
|
||||
.map(|(name, addr)| {
|
||||
if name.is_empty() {
|
||||
Address::new_mailbox(addr.to_string())
|
||||
} else {
|
||||
Address::new_mailbox_with_name(name.to_string(), addr.to_string())
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut message = email::MimeMessage::new_blank_message();
|
||||
message.headers.insert(
|
||||
(
|
||||
"Content-Type".to_string(),
|
||||
"text/plain; charset=utf-8; format=flowed; delsp=no".to_string(),
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
message
|
||||
.headers
|
||||
.insert(Header::new_with_value("To".into(), to).unwrap());
|
||||
message.body = "Hi".to_string();
|
||||
|
||||
let msg = message.as_string();
|
||||
|
||||
let header_end = msg.find("Hi").unwrap();
|
||||
#[allow(clippy::indexing_slicing)]
|
||||
let headers = msg[0..header_end].trim();
|
||||
|
||||
assert!(!headers.lines().any(|l| l.trim().is_empty()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user