Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6beb9902 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #1976 from k9mail/GH-1959_support_header_field_name_with_space

Add support for obsolete header field format
parents d0c13766 db791579
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -170,10 +170,6 @@ public class MimeHeader implements Cloneable {
            if (raw == null) {
                throw new NullPointerException("Argument 'raw' cannot be null");
            }
            if (name != null && !raw.startsWith(name + ":")) {
                throw new IllegalArgumentException("The value of 'raw' needs to start with the supplied field name " +
                        "followed by a colon");
            }

            return new Field(name, null, raw);
        }
+10 −0
Original line number Diff line number Diff line
@@ -52,6 +52,16 @@ public class MimeMessageParseTest {
        assertEquals("this is some test text.", streamToString(MimeUtility.decodeBody(msg.getBody())));
    }

    @Test
    public void headerFieldNameWithSpace() throws Exception {
        MimeMessage msg = parseWithoutRecurse(toStream("" +
                "From : <adam@example.org>\r\n" +
                "\r\n" +
                "Body"));

        assertEquals("<adam@example.org>", msg.getHeader("From")[0]);
    }

    @Test
    public void testSinglePart8BitRecurse() throws Exception {
        MimeMessage msg = parseWithRecurse(toStream(