summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerkin <e.altunbas@vyos.io>2021-03-30 15:42:50 +0300
committererkin <e.altunbas@vyos.io>2021-03-30 15:42:50 +0300
commit229a884166946fb2ce1d7854bf62ed6019114915 (patch)
treeaba584adb7ce8fa216b67f9b67e2ce1fbf25ed40
parentd0a1bf49e2bcbabba74960027c5e3f75ab27853a (diff)
downloadvyos-1x-229a884166946fb2ce1d7854bf62ed6019114915.tar.gz
vyos-1x-229a884166946fb2ce1d7854bf62ed6019114915.zip
T3356: Encode strings given to/returned from curl in TFTP transfers
-rw-r--r--python/vyos/remote.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/python/vyos/remote.py b/python/vyos/remote.py
index ad9706a82..0c0de8e0f 100644
--- a/python/vyos/remote.py
+++ b/python/vyos/remote.py
@@ -57,11 +57,11 @@ def download_sftp(local_path, hostname, remote_path,\
def upload_tftp(local_path, hostname, remote_path, port=69):
with open(local_path, 'rb') as file:
- cmd(f'curl -s -T - tftp://{hostname}:{port}/{remote_path}', stderr=None, input=file.read())
+ cmd(f'curl -s -T - tftp://{hostname}:{port}/{remote_path}', stderr=None, input=file.read()).encode()
def download_tftp(local_path, hostname, remote_path, port=69):
with open(local_path, 'wb') as file:
- file.write(cmd(f'curl -s tftp://{hostname}:{port}/{remote_path}', stderr=None))
+ file.write(cmd(f'curl -s tftp://{hostname}:{port}/{remote_path}', stderr=None).encode())
def download_http(urlstring, local_path):
with open(local_path, 'wb') as file: