mirror of
https://github.com/apache/nifi.git
synced 2025-02-08 11:05:17 +00:00
NIFI-9196 Corrected FetchSFTP Move File destination formatting
- Changed FetchSFTP to use String.format() instead of File.getAbsolutePath() for defining the destination path as part of the Move File completion strategy This closes #7072 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
132bce4245
commit
cac76e339d
@ -350,13 +350,13 @@ public abstract class FetchFileTransfer extends AbstractProcessor {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final String absoluteTargetDirPath = transfer.getAbsolutePath(flowFile, targetDir);
|
final String absoluteTargetDirPath = transfer.getAbsolutePath(flowFile, targetDir);
|
||||||
final File targetFile = new File(absoluteTargetDirPath, simpleFilename);
|
|
||||||
if (context.getProperty(MOVE_CREATE_DIRECTORY).asBoolean()) {
|
if (context.getProperty(MOVE_CREATE_DIRECTORY).asBoolean()) {
|
||||||
// Create the target directory if necessary.
|
// Create the target directory if necessary.
|
||||||
transfer.ensureDirectoryExists(flowFile, targetFile.getParentFile());
|
transfer.ensureDirectoryExists(flowFile, new File(absoluteTargetDirPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
transfer.rename(flowFile, filename, targetFile.getAbsolutePath());
|
final String destinationPath = String.format("%s/%s", absoluteTargetDirPath, simpleFilename);
|
||||||
|
transfer.rename(flowFile, filename, destinationPath);
|
||||||
|
|
||||||
} catch (final IOException ioe) {
|
} catch (final IOException ioe) {
|
||||||
getLogger().warn("Successfully fetched the content for {} from {}:{}{} but failed to rename the remote file due to {}",
|
getLogger().warn("Successfully fetched the content for {} from {}:{}{} but failed to rename the remote file due to {}",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user