Geary.RFC822.Subject: Handle long headers being folded

Remove "\n " sequences from RFC822 text before decoding so that any
long subject lines folded before the 80 char limit are unfolded.

Fixes #895
This commit is contained in:
Michael Gratton 2021-01-20 19:20:30 +11:00
parent 900b51004b
commit b51b933b6d
3 changed files with 24 additions and 4 deletions

View file

@ -9,6 +9,7 @@ class Geary.RFC822.MessageDataTest : TestCase {
public MessageDataTest() {
base("Geary.RFC822.MessageDataTest");
add_test("subject_from_rfc822", subject_from_rfc822);
add_test("date_from_rfc822", date_from_rfc822);
add_test("date_from_rfc822", date_from_rfc822);
add_test("date_to_rfc822", date_to_rfc822);
@ -21,6 +22,14 @@ class Geary.RFC822.MessageDataTest : TestCase {
add_test("MessageIdList.merge", message_id_list_merge);
}
public void subject_from_rfc822() throws GLib.Error {
Subject plain = new Subject.from_rfc822_string("hello");
assert_equal(plain.to_string(), "hello");
Subject new_line = new Subject.from_rfc822_string("hello\n there");
assert_equal(new_line.to_string(), "hello there");
}
public void preview_text_with_header() throws GLib.Error {
PreviewText plain_preview1 = new PreviewText.with_header(
new Geary.Memory.StringBuffer(PLAIN_BODY1_HEADERS),