Open Hocuri opened 3 years ago
I just realized that the test doesn't correctly reproduce the problem in the newest version, but it's still there. Here is a test that should work:
#[test]
fn test_emit_no_empty_lines() {
// Please don't change anything to the intendation:
let header = "To: Nnnn <nnn@ttttttttt.de>,
=?utf-8?q?=F0=9F=98=80_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>";
let mut builder = Rfc5322Builder::new();
builder.emit_folded(&header.to_string()[..]);
builder.emit_raw("\r\n");
builder.emit_raw("\r\n");
let res = builder.result().trim();
println!("{}", res);
assert!(!res.lines().any(|l| l.trim().is_empty())); // <-- panics
}
Under some circumstances a the header in the final email contains an empty line. We are building an email client, and some messages are rejected because of this: https://github.com/deltachat/deltachat-core-rust/issues/2118
This test reproduces the problem:
Output: