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
FileExistsMode.REPLACE not working #8563
Comments
Can we see the whole stack trace, please? |
This is full stack trace.
|
So, it fails on |
@artembilan |
OK. Then this one is out of this project scope. |
Just came along this scenario in my project . We recently switched to use IntegrationFlow with FileExistsMode.FAIL in the first step. As of now we are facing exactly the same issue. We do have enabled useTemporaryFilename.
So in the end the old filename.ext named file is still on SFTP. And the log says:
We do have all the rights we need on SFTP Server to perform Are we missing any configuration? SFTP Documentation tells me to remove the target file before renaming. I thought SFTP Integration would handle this for me? |
The logic there is like this:
You fail exactly on that However I don't think it is always legit to remove old file for any exceptions thrown from the server. Would be great if you can consult with your SFTP server to see why its rename command does not return a proper error code. As I said before: we see that some error is thrown from rename command, but not all of them justify the file removal. |
But wouldn't it be more straight forward, when removing the file ain't intended, at least to clean up the .writing file? |
Sorry, the English is not my first language, and I cannot compile your sentence in my head. If you talk about removing a temporary Otherwise, please, clarify. |
That is exactly what I wanted to say.. :) |
OK. Repurpose this issue for temporary file removal when rename to the target file has failed. |
Yeah... Looks like we cannot remove that tmp file.
so, after removing we may lose an old data we have just appended to. I think we need to change the logic to something similar what we have with FTP and SMB:
I mean we have to remove the target existing file unconditionally before rename a tmp one into it. |
Fixes spring-projects#8563 * Rework the `SftpSession.rename()` logic to be similar to what is there in the `FtpSession`, for example: try to remove a remote target file before renaming. * Fix `SftpSession.remove()` to check for `SftpConstants.SSH_FX_NO_SUCH_FILE` response status to return `false`
Fixes #8563 * Rework the `SftpSession.rename()` logic to be similar to what is there in the `FtpSession`, for example: try to remove a remote target file before renaming. * Fix `SftpSession.remove()` to check for `SftpConstants.SSH_FX_NO_SUCH_FILE` response status to return `false`
In version 6.0.3
I'm new to spring integration
FileExistsMode.REPLACE throw exception instead it changes the original file.
I don't know if this is a bug.
The text was updated successfully, but these errors were encountered: