NissimShiman commented on a change in pull request #4627:
URL: https://github.com/apache/nifi/pull/4627#discussion_r526382460
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TailFile.java
##########
@@ -131,7 +131,7 @@
.displayName("Base directory")
.description("Base directory used to look for files to tail. This
property is required when using Multifile mode.")
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
- .addValidator(StandardValidators.FILE_EXISTS_VALIDATOR)
+ .addValidator(StandardValidators.DIRECTORY_EXISTS_VALIDATOR)
Review comment:
@tlsmith109 A new ticket should be opened if we want to modify TailFile
as well as the ticket is specific to FetchSFTP
That being said, it looks like there is code that already makes sure this is
a directory [1]. Although, at first glance I am unsure why this wasn't handled
here, as your code is suggesting.
[1]
https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TailFile.java#L277
##########
File path:
nifi-commons/nifi-utils/src/main/java/org/apache/nifi/processor/util/StandardValidators.java
##########
@@ -848,8 +849,8 @@ public ValidationResult validate(final String subject,
final String value, final
}
final File file = new File(substituted);
- final boolean valid = file.exists();
- final String explanation = valid ? null : "File " + file + " does
not exist";
+ final boolean valid = file.exists() & !file.isDirectory();
+ final String explanation = valid ? null : "File " + file + " does
not exist or is directory";
return new
ValidationResult.Builder().subject(subject).input(value).valid(valid).explanation(explanation).build();
}
Review comment:
@tlsmith109 I can see why these modifications were made, but it is out
of the scope of this ticket. It is best to open a new ticket specifically for
this so the community has visibility into modifying FileExistsValidator to not
include directories.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]