tools: wasptool: Fix binary downloads for a specific special case
Currently if the binary file being downloaded contains single quote characters then it gets wrapped differently by repr() so we have to add additional cases to strip the wrapper. Fix this the "obvious" way... where by "obvious" I mean almost anything but. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
181aad6666
commit
cabe6f143c
1 changed files with 9 additions and 1 deletions
|
@ -254,7 +254,15 @@ def handle_binary_download(c, tname, fname):
|
||||||
while True:
|
while True:
|
||||||
draw_pbar(100 * bytes_read / sz, verbose)
|
draw_pbar(100 * bytes_read / sz, verbose)
|
||||||
reply = c.run_command('repr(f.read(24))')
|
reply = c.run_command('repr(f.read(24))')
|
||||||
data = eval(reply.replace('\\\\', '\\').strip('"'))
|
reply = reply.replace('\\\\', '\\')
|
||||||
|
if reply.startswith('"'):
|
||||||
|
# "b'..CONTENT..'"
|
||||||
|
reply = reply[1:-1]
|
||||||
|
elif reply.startswith("'"):
|
||||||
|
# 'b\'..CONTENT..\''
|
||||||
|
reply = reply[1:-1].replace("\\'", "'")
|
||||||
|
data = print(reply)
|
||||||
|
data = eval(reply)
|
||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
break
|
break
|
||||||
bytes_read += len(data)
|
bytes_read += len(data)
|
||||||
|
|
Loading…
Reference in a new issue