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 <joewitt@apache.org>
This commit is contained in:
Joe Witt 2020-01-18 21:32:48 -05:00
parent 3d99d02f93
commit b205b99668
No known key found for this signature in database
GPG Key ID: 9093BF854F811A1A

View File

@ -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);
}