Skip to content

Commit 1c90a60

Browse files
authored
GH-8566: Fix SftpSession.append() for Write (#8576)
Fixes #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`**
1 parent f2b88b4 commit 1c90a60

File tree

1 file changed

+4
-1
lines changed
  • spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session

1 file changed

+4
-1
lines changed

spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ public void write(InputStream inputStream, String destination) throws IOExceptio
132132
public void append(InputStream inputStream, String destination) throws IOException {
133133
synchronized (this.sftpClient) {
134134
OutputStream outputStream =
135-
this.sftpClient.write(destination, SftpClient.OpenMode.Create, SftpClient.OpenMode.Append);
135+
this.sftpClient.write(destination,
136+
SftpClient.OpenMode.Create,
137+
SftpClient.OpenMode.Write,
138+
SftpClient.OpenMode.Append);
136139
FileCopyUtils.copy(inputStream, outputStream);
137140
}
138141
}

0 commit comments

Comments
 (0)