Description
In what version(s) of Spring Integration are you seeing this issue?
6.0
Describe the bug
When calling the SFTPSession.append() method, the application returns a SSH_FX_NO_SUCH_FILE. I've tried with the file already created in the SFTP server, and I've tried also with the method write and then trying to append but the append method throws the same error.
I've been looking into the code and I think that a flag is missing:
@OverRide
public void append(InputStream inputStream, String destination) throws IOException {
synchronized (this.sftpClient) {
OutputStream outputStream =
this.sftpClient.write(destination, SftpClient.OpenMode.Create, SftpClient.OpenMode.Append);
FileCopyUtils.copy(inputStream, outputStream);
}
}
In the flags the SftpClient.OpenMode.Write is missing. I've tried the same exact code but with that added flag and it works that way with the intended functionality (appending to a file).
To Reproduce
Create a sample application connected to a SFTP Server and trying to use the method SFTPSession.append().
Expected behavior
The expected behavior would be for the content to be appended to a file already existing, or to create a new file with the content if such file doesn't exist.
The actual behavior is the fail I've mentioned earlier.