Keep zip content as binary

pull/92/head
Raphaël Vinot 2017-01-07 19:30:00 -05:00
parent 9f84db3659
commit 1051e2210b
1 changed files with 1 additions and 1 deletions

View File

@ -193,7 +193,7 @@ def get_zipped_contents(filename, data, password=None):
password = str.encode(password) # Byte encoded password required
for zip_file_name in zf.namelist(): # Get all files in the zip file
with zf.open(zip_file_name, mode='r', pwd=password) as fp:
file_data = io.TextIOWrapper(fp).read().encode()
file_data = fp.read()
unzipped_files.append({"values": zip_file_name,
"data": base64.b64encode(file_data).decode(), # Any password works when not encrypted
"comment": "Extracted from {0}".format(filename)})