[jira] [Commented] (NIFI-5252) Allow arbitrary headers in PutEmail processor
[ https://issues.apache.org/jira/browse/NIFI-5252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16513756#comment-16513756 ] ASF GitHub Bot commented on NIFI-5252: -- Github user asfgit closed the pull request at: https://github.com/apache/nifi/pull/2787 > Allow arbitrary headers in PutEmail processor > - > > Key: NIFI-5252 > URL: https://issues.apache.org/jira/browse/NIFI-5252 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Dustin Rodrigues >Priority: Minor > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5252) Allow arbitrary headers in PutEmail processor
[ https://issues.apache.org/jira/browse/NIFI-5252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16513729#comment-16513729 ] ASF GitHub Bot commented on NIFI-5252: -- Github user ottobackwards commented on the issue: https://github.com/apache/nifi/pull/2787 The changes to the encoding looks good. Thanks for the contribution! +1 > Allow arbitrary headers in PutEmail processor > - > > Key: NIFI-5252 > URL: https://issues.apache.org/jira/browse/NIFI-5252 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Dustin Rodrigues >Priority: Minor > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5252) Allow arbitrary headers in PutEmail processor
[ https://issues.apache.org/jira/browse/NIFI-5252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16513727#comment-16513727 ] ASF GitHub Bot commented on NIFI-5252: -- Github user pvillard31 commented on the issue: https://github.com/apache/nifi/pull/2787 LGTM - @ottobackwards can you have a look as well? if all looks good for you, will merge to master. Thanks guys! > Allow arbitrary headers in PutEmail processor > - > > Key: NIFI-5252 > URL: https://issues.apache.org/jira/browse/NIFI-5252 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Dustin Rodrigues >Priority: Minor > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5252) Allow arbitrary headers in PutEmail processor
[ https://issues.apache.org/jira/browse/NIFI-5252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16513254#comment-16513254 ] ASF GitHub Bot commented on NIFI-5252: -- Github user dtrodrigues commented on the issue: https://github.com/apache/nifi/pull/2787 moved regex compilation to when processor is scheduled and ensured header values are encoded appropriately > Allow arbitrary headers in PutEmail processor > - > > Key: NIFI-5252 > URL: https://issues.apache.org/jira/browse/NIFI-5252 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Dustin Rodrigues >Priority: Minor > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5252) Allow arbitrary headers in PutEmail processor
[ https://issues.apache.org/jira/browse/NIFI-5252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16509504#comment-16509504 ] ASF GitHub Bot commented on NIFI-5252: -- Github user ottobackwards commented on a diff in the pull request: https://github.com/apache/nifi/pull/2787#discussion_r194700389 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutEmail.java --- @@ -319,6 +330,15 @@ public void onTrigger(final ProcessContext context, final ProcessSession session message.setRecipients(RecipientType.CC, toInetAddresses(context, flowFile, CC)); message.setRecipients(RecipientType.BCC, toInetAddresses(context, flowFile, BCC)); +final String attributeNameRegex = context.getProperty(ATTRIBUTE_NAME_REGEX).getValue(); +final Pattern attributeNamePattern = attributeNameRegex == null ? null : Pattern.compile(attributeNameRegex); +if (attributeNamePattern != null) { +for (final Map.Entry entry : flowFile.getAttributes().entrySet()) { +if (attributeNamePattern.matcher(entry.getKey()).matches()) { --- End diff -- There are rules about how the headers have to be encoded. We should use the MimeUtility to ensure everything is encoded correctly. ``` Note that RFC 822 headers must contain only US-ASCII characters, so a header that contains non US-ASCII characters must have been encoded by the caller as per the rules of RFC 2047. ``` [MimeUtility](https://docs.oracle.com/javaee/6/api/javax/mail/internet/MimeUtility.html) We should also have tests for ensuring attributes with content that must be encoded are handled. > Allow arbitrary headers in PutEmail processor > - > > Key: NIFI-5252 > URL: https://issues.apache.org/jira/browse/NIFI-5252 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Dustin Rodrigues >Priority: Minor > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5252) Allow arbitrary headers in PutEmail processor
[ https://issues.apache.org/jira/browse/NIFI-5252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16509269#comment-16509269 ] ASF GitHub Bot commented on NIFI-5252: -- Github user pvillard31 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2787#discussion_r194632391 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutEmail.java --- @@ -319,6 +330,15 @@ public void onTrigger(final ProcessContext context, final ProcessSession session message.setRecipients(RecipientType.CC, toInetAddresses(context, flowFile, CC)); message.setRecipients(RecipientType.BCC, toInetAddresses(context, flowFile, BCC)); +final String attributeNameRegex = context.getProperty(ATTRIBUTE_NAME_REGEX).getValue(); +final Pattern attributeNamePattern = attributeNameRegex == null ? null : Pattern.compile(attributeNameRegex); --- End diff -- Could we move the compile outside the onTrigger call? I think it's better to make this call when the processor is scheduled. > Allow arbitrary headers in PutEmail processor > - > > Key: NIFI-5252 > URL: https://issues.apache.org/jira/browse/NIFI-5252 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Dustin Rodrigues >Priority: Minor > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5252) Allow arbitrary headers in PutEmail processor
[ https://issues.apache.org/jira/browse/NIFI-5252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16509093#comment-16509093 ] ASF GitHub Bot commented on NIFI-5252: -- GitHub user dtrodrigues opened a pull request: https://github.com/apache/nifi/pull/2787 NIFI-5252 - support arbitrary headers in PutEmail processor Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [ ] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ ] Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/dtrodrigues/nifi NIFI-5252 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2787.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2787 commit 250736cc14ffb6c44925fe606b5de67d7a53638a Author: Dustin Rodrigues Date: 2018-06-12T02:00:28Z NIFI-5252 - support arbitrary headers in PutEmail processor > Allow arbitrary headers in PutEmail processor > - > > Key: NIFI-5252 > URL: https://issues.apache.org/jira/browse/NIFI-5252 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Dustin Rodrigues >Priority: Minor > -- This message was sent by Atlassian JIRA (v7.6.3#76005)