mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DOCX Output: Ignore corrupted images in the input instead of erroring out on them.
This commit is contained in:
parent
23a6c43552
commit
2ba85a0869
@ -49,7 +49,12 @@ class ImagesManager(object):
|
||||
item = self.oeb.manifest.hrefs.get(href)
|
||||
if item is None or not isinstance(item.data, bytes):
|
||||
return
|
||||
width, height, fmt = identify_data(item.data)
|
||||
try:
|
||||
width, height, fmt = identify_data(item.data)
|
||||
except Exception:
|
||||
self.log.warning('Replacing corrupted image with blank: %s' % href)
|
||||
item.data = I('blank.png', data=True, allow_user_override=False)
|
||||
width, height, fmt = identify_data(item.data)
|
||||
image_fname = 'media/' + self.create_filename(href, fmt)
|
||||
image_rid = self.document_relationships.add_image(image_fname)
|
||||
self.images[href] = Image(image_rid, image_fname, width, height, fmt, item)
|
||||
|
Loading…
x
Reference in New Issue
Block a user