exceptionfactory commented on code in PR #8011:
URL: https://github.com/apache/nifi/pull/8011#discussion_r1393209952


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/IdentifyMimeType.java:
##########
@@ -89,14 +89,17 @@
 @Tags({"compression", "gzip", "bzip2", "zip", "MIME", "mime.type", "file", 
"identify"})
 @CapabilityDescription("Attempts to identify the MIME Type used for a 
FlowFile. If the MIME Type can be identified, "
         + "an attribute with the name 'mime.type' is added with the value 
being the MIME Type. If the MIME Type cannot be determined, "
-        + "the value will be set to 'application/octet-stream'. In addition, 
the attribute mime.extension will be set if a common file "
-        + "extension for the MIME Type is known.")
+        + "the value will be set to 'application/octet-stream'. In addition, 
the attribute 'mime.extension' will be set if a common file "
+        + "extension for the MIME Type is known. If the MIME Type detected is 
of type text/*, attempts to identify the charset used " +
+        "and an attribute with the name 'mime.charset' is added with the value 
being the charset.")
 @WritesAttributes({
-@WritesAttribute(attribute = "mime.type", description = "This Processor sets 
the FlowFile's mime.type attribute to the detected MIME Type. "
-        + "If unable to detect the MIME Type, the attribute's value will be 
set to application/octet-stream"),
-@WritesAttribute(attribute = "mime.extension", description = "This Processor 
sets the FlowFile's mime.extension attribute to the file "
-        + "extension associated with the detected MIME Type. "
-        + "If there is no correlated extension, the attribute's value will be 
empty")
+        @WritesAttribute(attribute = "mime.type", description = "This 
Processor sets the FlowFile's mime.type attribute to the detected MIME Type. "
+                + "If unable to detect the MIME Type, the attribute's value 
will be set to application/octet-stream"),
+        @WritesAttribute(attribute = "mime.extension", description = "This 
Processor sets the FlowFile's mime.extension attribute to the file "
+                + "extension associated with the detected MIME Type. "
+                + "If there is no correlated extension, the attribute's value 
will be empty"),
+        @WritesAttribute(attribute = "mime.charset", description = "This 
Processor sets the FlowFile's mime.charset attribute to the detected charset. "
+                + "If unable to detect the charset or the detected MIME type 
is not of type text/*, the attribute's value will be empty")

Review Comment:
   Thanks for making the change to the new `mime.charset` approach. I think the 
existing approach for `mime.extension` should be left unchanged to avoid 
unexpected changes for existing flows. Since this is a new attribute that only 
applies for text types, it seems better to set it only when it is not null.



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to