-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SFTP: Failed to transfer file if temporary remote directory doesn't exist #9684
Comments
That version is out of support for a while. Any chances to check your solution with much newer one: https://spring.io/projects/spring-integration#learn ? |
I think 6.4.0 has the same problem. I check source code and find out that the bug is in org.springframework.integration.file.remote.RemoteFileTemplate on method sendFileToRemoteDirectory |
Ok. I’m out for vacation until next week. So, if you have some idea how to fix, feel free to open PR and I’ll look shortly when I’m back . |
Essentially, the
|
Correct. I used this code as a workaround for my project |
Fixes: #9684 Issue link: #9684 The `RemoteFileTemplate` is missing to create a temporary remote directory * Fix `RemoteFileTemplate.sendFileToRemoteDirectory()` to create a `temporaryRemoteDirectory` as well if it is different from already created `remoteDirectory` * Add `SftpServerOutboundTests.autoCreateTemporaryDirectory()` to verify that `temporaryRemoteDirectory` is created and in-use * Some other `SftpServerOutboundTests` refactoring for better code style (cherry picked from commit a4b193f)
5.5.20
Describe the bug
I use SftpMessageHandler to send files to a remote SFTP server.
I want to transfer files using a temporary remote directory. Transfer is aborted if the temporary remote doesn't exist, otherwise it works fine.
To Reproduce
Transfer file test.txt to /remote setting /remote_temp as temporary directory. /remote_temp doesn't exist on target server
Expected behavior
If /remote_temp doesn't exist on remote server and autoCreateDirectory is true, the file is sent to /remote and /remote_temp is created to store the file before moving to final destination.
Sample
SftpMessageHandler handler = new SftpMessageHandler(sftpSessionFactory) ;
handler.setRemoteDirectoryExpressionString("headers['remoteDirectory']");
handler.setTemporaryRemoteDirectoryExpressionString("headers['remoteTempDirectory']");
handler.setAutoCreateDirectory(true);
The text was updated successfully, but these errors were encountered: