1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-06-13 17:06:50 +00:00

Fix encoding errors on windows while downloading logbooks

This commit is contained in:
Ozzie Isaacs 2021-07-12 17:33:35 +02:00
parent 616cc2018a
commit 20fa9f5523

View File

@ -22,10 +22,6 @@ import glob
import zipfile
import json
from io import BytesIO
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import os
@ -38,9 +34,9 @@ log = logger.create()
def assemble_logfiles(file_name):
log_list = sorted(glob.glob(file_name + '*'), reverse=True)
wfd = StringIO()
wfd = BytesIO()
for f in log_list:
with open(f, 'r') as fd:
with open(f, 'rb') as fd:
shutil.copyfileobj(fd, wfd)
wfd.seek(0)
if int(__version__.split('.')[0]) < 2: