mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make icon theme cover file writing atomic
This commit is contained in:
parent
efb6405ff1
commit
3bf65b261e
@ -475,8 +475,10 @@ def get_cover(metadata):
|
||||
etag = etag.decode('utf-8')
|
||||
cached, etag = download_cover(metadata['cover-url'], etag, cached)
|
||||
if cached:
|
||||
with open(cover_file, 'wb') as f:
|
||||
aname = cover_file + '.atomic'
|
||||
with open(aname, 'wb') as f:
|
||||
f.write(cached)
|
||||
atomic_rename(aname, cover_file)
|
||||
if etag:
|
||||
with open(etag_file, 'wb') as f:
|
||||
f.write(as_bytes(etag))
|
||||
|
Loading…
x
Reference in New Issue
Block a user