mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit Book: Fix another bug in the save/close/re-open edit cycle for AZW3 that could cause images/fonts to get mixed up. Fixes #1276726 [Private bug](https://bugs.launchpad.net/calibre/+bug/1276726)
This commit is contained in:
parent
d3e308e5ef
commit
07fdff36a4
@ -415,18 +415,17 @@ class Mobi8Reader(object):
|
|||||||
if font['encrypted']:
|
if font['encrypted']:
|
||||||
self.encrypted_fonts.append(href)
|
self.encrypted_fonts.append(href)
|
||||||
else:
|
else:
|
||||||
if len(data) == len(PLACEHOLDER_GIF) and data == PLACEHOLDER_GIF:
|
if not (len(data) == len(PLACEHOLDER_GIF) and data == PLACEHOLDER_GIF):
|
||||||
continue
|
imgtype = what(None, data)
|
||||||
imgtype = what(None, data)
|
if imgtype is None:
|
||||||
if imgtype is None:
|
from calibre.utils.magick.draw import identify_data
|
||||||
from calibre.utils.magick.draw import identify_data
|
try:
|
||||||
try:
|
imgtype = identify_data(data)[2]
|
||||||
imgtype = identify_data(data)[2]
|
except Exception:
|
||||||
except Exception:
|
imgtype = 'unknown'
|
||||||
imgtype = 'unknown'
|
href = 'images/%05d.%s'%(fname_idx, imgtype)
|
||||||
href = 'images/%05d.%s'%(fname_idx, imgtype)
|
with open(href.replace('/', os.sep), 'wb') as f:
|
||||||
with open(href.replace('/', os.sep), 'wb') as f:
|
f.write(data)
|
||||||
f.write(data)
|
|
||||||
|
|
||||||
resource_map.append(href)
|
resource_map.append(href)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user