mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-30 18:55:35 +01:00
py3: Fix icon theme download not working
This commit is contained in:
parent
73493976e8
commit
099b0cd726
1 changed files with 3 additions and 2 deletions
|
|
@ -34,7 +34,7 @@
|
|||
from calibre.utils.zipfile import ZipFile, ZIP_STORED
|
||||
from calibre.utils.filenames import atomic_rename
|
||||
from lzma.xz import compress, decompress
|
||||
from polyglot.builtins import iteritems, map, range, reraise, filter
|
||||
from polyglot.builtins import iteritems, map, range, reraise, filter, as_bytes
|
||||
from polyglot import http_client
|
||||
from polyglot.queue import Queue, Empty
|
||||
|
||||
|
|
@ -468,13 +468,14 @@ def safe_read(path):
|
|||
raise
|
||||
return b''
|
||||
etag, cached = safe_read(etag_file), safe_read(cover_file)
|
||||
etag = etag.decode('utf-8')
|
||||
cached, etag = download_cover(metadata['cover-url'], etag, cached)
|
||||
if cached:
|
||||
with open(cover_file, 'wb') as f:
|
||||
f.write(cached)
|
||||
if etag:
|
||||
with open(etag_file, 'wb') as f:
|
||||
f.write(etag)
|
||||
f.write(as_bytes(etag))
|
||||
return cached or b''
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue