Skip to content

Commit

Permalink
sftp: Fix downloading files
Browse files Browse the repository at this point in the history
Fixes: ansible#341
Signed-off-by: Jakub Jelen <[email protected]>
  • Loading branch information
Jakuje committed Nov 19, 2024
1 parent 6ce8f9a commit a506294
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pylibsshext/sftp.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ cdef class SFTP:
raise LibsshSFTPException("Reading data from remote file [%s] failed with error [%s]"
% (remote_file, self._get_sftp_error_str()))

with open(local_file, 'wb+') as f:
with open(local_file, 'ab') as f:
bytes_written = f.write(read_buffer[:file_data])
if bytes_written and file_data != bytes_written:
sftp.sftp_close(rf)
Expand Down

0 comments on commit a506294

Please sign in to comment.