diff --git a/src/calibre/gui2/icon_theme.py b/src/calibre/gui2/icon_theme.py index e1bb2b3e52..533bf6f292 100644 --- a/src/calibre/gui2/icon_theme.py +++ b/src/calibre/gui2/icon_theme.py @@ -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))