diff --git a/greenmail-core/src/main/java/com/icegreen/greenmail/store/SimpleMessageAttributes.java b/greenmail-core/src/main/java/com/icegreen/greenmail/store/SimpleMessageAttributes.java index f0d3ffebbc..69b5455177 100644 --- a/greenmail-core/src/main/java/com/icegreen/greenmail/store/SimpleMessageAttributes.java +++ b/greenmail-core/src/main/java/com/icegreen/greenmail/store/SimpleMessageAttributes.java @@ -479,22 +479,19 @@ String parseBodyStructure(boolean includeExtension) { String fields = parseBodyFields(); StringBuilder buf = new StringBuilder(); buf.append(LB); - if (primaryType.equalsIgnoreCase("Text")) { - buf.append("\"TEXT\" \""); - buf.append(secondaryType.toUpperCase()); - buf.append("\" "); - buf.append(fields); - buf.append(' '); - buf.append(lineCount); + if (primaryType.equalsIgnoreCase("TEXT")) { + buf.append('"').append(primaryType).append("\" \"") + .append(secondaryType).append("\" ") + .append(fields) + .append(' ') + .append(lineCount); // is: * 1 FETCH (BODYSTRUCTURE ("Text" "plain" NIL NIL NIL NIL 4 -1)) // wants: * 1 FETCH (BODYSTRUCTURE ("text" "plain" NIL NIL NIL "8bit" 6 1 NIL NIL NIL)) // or: * 1 FETCH (BODYSTRUCTURE ("text" "plain" NIL NIL NIL "7bit" 28 1 NIL NIL NIL)) - } else if (primaryType.equalsIgnoreCase(MESSAGE) && secondaryType.equalsIgnoreCase("rfc822")) { buf.append("\"MESSAGE\" \"RFC822\" "); buf.append(fields).append(SP); -// setupLogger(parts[0]); // reset transient logger buf.append(parts[0].getEnvelope()).append(SP); buf.append(parts[0].getBodyStructure(false)).append(SP); buf.append(lineCount); diff --git a/greenmail-core/src/test/java/com/icegreen/greenmail/examples/ExampleSendReceiveMessageWithInlineAttachmentTest.java b/greenmail-core/src/test/java/com/icegreen/greenmail/examples/ExampleSendReceiveMessageWithInlineAttachmentTest.java index 46a4751241..376651912d 100644 --- a/greenmail-core/src/test/java/com/icegreen/greenmail/examples/ExampleSendReceiveMessageWithInlineAttachmentTest.java +++ b/greenmail-core/src/test/java/com/icegreen/greenmail/examples/ExampleSendReceiveMessageWithInlineAttachmentTest.java @@ -50,7 +50,7 @@ private void fetchEmailWithInlineAttachment() throws MessagingException, IOExcep assertThat(part.getCount()).isEqualTo(1); final BodyPart bodyPart = part.getBodyPart(0); - assertThat(bodyPart.getContentType()).isEqualTo("TEXT/PLAIN; charset=us-ascii"); + assertThat(bodyPart.getContentType()).isEqualTo("text/plain; charset=us-ascii"); assertThat(bodyPart.getDisposition()).isEqualTo("inline"); assertThat(bodyPart.getContent()).isEqualTo("This is some text to be displayed inline"); } diff --git a/greenmail-core/src/test/java/com/icegreen/greenmail/specificmessages/EncodingTest.java b/greenmail-core/src/test/java/com/icegreen/greenmail/specificmessages/EncodingTest.java index 23dad4d0de..237931c875 100644 --- a/greenmail-core/src/test/java/com/icegreen/greenmail/specificmessages/EncodingTest.java +++ b/greenmail-core/src/test/java/com/icegreen/greenmail/specificmessages/EncodingTest.java @@ -103,20 +103,20 @@ public void testTextPlainWithUTF8() throws MessagingException, IOException { // QP-encoded final BodyPart bodyPart0 = multipartReceived.getBodyPart(0); - assertThat(bodyPart0.getContentType()).isEqualTo("TEXT/JAVASCRIPT; charset=utf-8"); + assertThat(bodyPart0.getContentType()).isEqualTo("text/javascript; charset=utf-8"); assertThat(textQP.getContent()).isEqualTo(EncodingUtil.toString((InputStream) bodyPart0.getContent(), StandardCharsets.UTF_8)); // 8-BIT-encoded final BodyPart bodyPart1 = multipartReceived.getBodyPart(1); - assertThat(bodyPart1.getContentType()).isEqualTo("TEXT/HTML; charset=utf-8"); + assertThat(bodyPart1.getContentType()).isEqualTo("text/html; charset=utf-8"); assertThat(bodyPart1.getContent()).isEqualTo(html.getContent()); // Fails final BodyPart bodyPart2 = multipartReceived.getBodyPart(2); - assertThat(bodyPart2.getContentType()).isEqualTo("TEXT/PLAIN; charset=utf-8"); + assertThat(bodyPart2.getContentType()).isEqualTo("text/plain; charset=utf-8"); assertThat(bodyPart2.getContent()).isEqualTo(text.getContent()); final BodyPart bodyPart3 = multipartReceived.getBodyPart(3); - assertThat(bodyPart3.getContentType()).isEqualTo("TEXT/PLAIN; charset=utf-8"); + assertThat(bodyPart3.getContentType()).isEqualTo("text/plain; charset=utf-8"); assertThat(bodyPart3.getContent()).isEqualTo(text2QP.getContent()); } finally { store.close();