This is an automated email from the ASF dual-hosted git repository.

joewitt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
     new b205b99  NIFI-7041 This closes #4000. Ensure that if the permissions 
arent set by the flowfile or processor property that we dont attempt to set 
perms on the remote host
b205b99 is described below

commit b205b99668152683384219f821854c0e563c2b46
Author: Joe Witt <[email protected]>
AuthorDate: Sat Jan 18 21:32:48 2020 -0500

    NIFI-7041 This closes #4000. Ensure that if the permissions arent set by 
the flowfile or processor property that we dont attempt to set perms on the 
remote host
    
    Signed-off-by: Joe Witt <[email protected]>
---
 .../java/org/apache/nifi/processors/standard/util/SFTPTransfer.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java
index 5180582..dda1456 100644
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java
@@ -709,7 +709,11 @@ public class SFTPTransfer implements FileTransfer {
 
         int perms = 0;
         final String permissions = 
ctx.getProperty(PERMISSIONS).evaluateAttributeExpressions(flowFile).getValue();
-        if (permissions != null && !permissions.trim().isEmpty()) {
+        if (permissions == null || permissions.trim().isEmpty()) {
+            sftpClient.getFileTransfer().setPreserveAttributes(false); //We 
will accept whatever the default permissions are of the destination
+            perms = 0;
+        } else {
+            sftpClient.getFileTransfer().setPreserveAttributes(true); //We 
will use the permissions supplied by evaluating processor property expression
             perms = numberPermissions(permissions);
         }
 

Reply via email to