don't handle format parameter in setBody(), style fixes
This commit is contained in:
parent
dc3d1f0e87
commit
a055ed42a8
3 changed files with 6 additions and 7 deletions
|
@ -36,10 +36,6 @@ public class MimeMessageHelper {
|
|||
if (name != null) {
|
||||
contentType += String.format(";\r\n name=\"%s\"", name);
|
||||
}
|
||||
boolean isFlowed = MimeUtility.isFormatFlowed(part.getContentType());
|
||||
if (isFlowed) {
|
||||
contentType += "; format=flowed";
|
||||
}
|
||||
} else {
|
||||
contentType = part.getMimeType();
|
||||
}
|
||||
|
|
|
@ -1142,8 +1142,10 @@ public class MimeUtility {
|
|||
}
|
||||
|
||||
static boolean isFormatFlowed(String contentType) {
|
||||
if (TEXT_PLAIN.equalsIgnoreCase(getHeaderParameter(contentType, null))) {
|
||||
return HEADER_FORMAT_FLOWED.equalsIgnoreCase(getHeaderParameter(contentType, HEADER_PARAM_FORMAT));
|
||||
String mimeType = getHeaderParameter(contentType, null);
|
||||
if (isSameMimeType(TEXT_PLAIN, mimeType)) {
|
||||
String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT);
|
||||
return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ public class MessageViewInfoExtractorTest {
|
|||
// Create message
|
||||
MimeMessage message = new MimeMessage();
|
||||
MimeMessageHelper.setBody(message, body);
|
||||
message.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/plain; format=flowed");
|
||||
|
||||
// Prepare fixture
|
||||
HtmlSanitizer htmlSanitizer = mock(HtmlSanitizer.class);
|
||||
|
@ -125,8 +126,8 @@ public class MessageViewInfoExtractorTest {
|
|||
|
||||
// Create message
|
||||
MimeMessage message = new MimeMessage();
|
||||
message.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/plain; format=flowed");
|
||||
MimeMessageHelper.setBody(message, body);
|
||||
message.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/plain; format=flowed");
|
||||
|
||||
// Extract text
|
||||
List<Part> outputNonViewableParts = new ArrayList<>();
|
||||
|
|
Loading…
Reference in a new issue