Skip to content
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

jumpssh 'get' fails if the remote file is binary. It is wrong to assume the files to get are text files #51

Closed
pshaobow opened this issue Apr 3, 2019 · 2 comments
Labels

Comments

@pshaobow
Copy link

pshaobow commented Apr 3, 2019

jump.SSHSession.get function uses the following codes to get a remote file and the write to a local file:
with open(local_path, mode='w') as local_file:
with sftp_client.file(copy_path) as remote_file:
local_file.write(remote_file.read().decode('utf-8'))
When the remote file is in binary format such as PCAP file, it fails at the decode('utf-8').
The following should work for binary file:
with open(local_path, mode='wb') as local_file:
with sftp_client.file(copy_path) as remote_file:
local_file.write(remote_file.read())
A file format argument may be added to distinguish the ascii/text from bin (binary) type.

@t-cas
Copy link
Contributor

t-cas commented Apr 4, 2019

Indeed thanks for catching that @pshaobow !
I will work on the fix

@t-cas t-cas added the bug label Apr 4, 2019
t-cas added a commit to t-cas/JumpSSH that referenced this issue Apr 7, 2019
t-cas added a commit to t-cas/JumpSSH that referenced this issue Apr 7, 2019
t-cas added a commit to t-cas/JumpSSH that referenced this issue Apr 7, 2019
t-cas added a commit to t-cas/JumpSSH that referenced this issue Apr 7, 2019
@t-cas
Copy link
Contributor

t-cas commented Apr 8, 2019

fix delivered in release 1.6.1

@t-cas t-cas closed this as completed Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants