From 229a884166946fb2ce1d7854bf62ed6019114915 Mon Sep 17 00:00:00 2001 From: erkin Date: Tue, 30 Mar 2021 15:42:50 +0300 Subject: T3356: Encode strings given to/returned from curl in TFTP transfers --- python/vyos/remote.py | 4 ++-- 1 file 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: -- cgit v1.2.3