exceptionfactory commented on a change in pull request #5622:
URL: https://github.com/apache/nifi/pull/5622#discussion_r788051831
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutEmail.java
##########
@@ -362,17 +373,16 @@ public void onTrigger(final ProcessContext context, final
ProcessSession session
}
this.setMessageHeader("X-Mailer",
context.getProperty(HEADER_XMAILER).evaluateAttributeExpressions(flowFile).getValue(),
message);
message.setSubject(context.getProperty(SUBJECT).evaluateAttributeExpressions(flowFile).getValue());
-
final String messageText = getMessage(flowFile, context, session);
- final String contentType =
context.getProperty(CONTENT_TYPE).evaluateAttributeExpressions(flowFile).getValue();
+ final String contentType =
context.getProperty(CONTENT_TYPE).evaluateAttributeExpressions(flowFile).getValue().split(";")[0]
+ "; charset=\"utf-8\"";
Review comment:
The `split()` seems unnecessary, can it be removed? Appending
`charset="utf-8"` implies that the Content Type will always be UTF-8, is that
correct?
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutEmail.java
##########
@@ -362,17 +373,16 @@ public void onTrigger(final ProcessContext context, final
ProcessSession session
}
this.setMessageHeader("X-Mailer",
context.getProperty(HEADER_XMAILER).evaluateAttributeExpressions(flowFile).getValue(),
message);
message.setSubject(context.getProperty(SUBJECT).evaluateAttributeExpressions(flowFile).getValue());
-
final String messageText = getMessage(flowFile, context, session);
- final String contentType =
context.getProperty(CONTENT_TYPE).evaluateAttributeExpressions(flowFile).getValue();
+ final String contentType =
context.getProperty(CONTENT_TYPE).evaluateAttributeExpressions(flowFile).getValue().split(";")[0]
+ "; charset=\"utf-8\"";
message.setContent(messageText, contentType);
message.setSentDate(new Date());
if (context.getProperty(ATTACH_FILE).asBoolean()) {
final MimeBodyPart mimeText = new
PreencodedMimeBodyPart("base64");
mimeText.setDataHandler(new DataHandler(new
ByteArrayDataSource(
-
Base64.encodeBase64(messageText.getBytes(CONTENT_CHARSET)), contentType + ";
charset=\"utf-8\"")));
+
Base64.encodeBase64(messageText.getBytes(StandardCharsets.UTF_8)),
contentType)));
Review comment:
Should `StandardCharsets.UTF_8` be replaced with the configured value of
Input Character Set?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]