GH-8566: Fix SftpSession.append() for Write (#8576)
Fixes https://github.com/spring-projects/spring-integration/issues/8566 Turns out some SFTP servers are strict enough to not let to append into existing file if we don't give in addition a `Write` open mode flag as well **Cherry-pick to `6.0.x`**
This commit is contained in:
@@ -132,7 +132,10 @@ public class SftpSession implements Session<SftpClient.DirEntry> {
|
||||
public void append(InputStream inputStream, String destination) throws IOException {
|
||||
synchronized (this.sftpClient) {
|
||||
OutputStream outputStream =
|
||||
this.sftpClient.write(destination, SftpClient.OpenMode.Create, SftpClient.OpenMode.Append);
|
||||
this.sftpClient.write(destination,
|
||||
SftpClient.OpenMode.Create,
|
||||
SftpClient.OpenMode.Write,
|
||||
SftpClient.OpenMode.Append);
|
||||
FileCopyUtils.copy(inputStream, outputStream);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user