DOCX Output: Fix conversion failing if the input document has missing images. See #1926025 (Conversion from EPUB to PDF failed)

This commit is contained in:
Kovid Goyal 2021-04-25 09:22:54 +05:30
parent 4a54f217df
commit 456e2e7e41
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -51,7 +51,11 @@ class ImagesManager(object):
def read_image(self, href):
if href not in self.images:
item = self.oeb.manifest.hrefs.get(href) or self.oeb.manifest.hrefs.get(urlquote(href))
if item is None or not isinstance(item.data, bytes):
try:
if item is None or not isinstance(item.data, bytes):
self.log.warning('Failed to find image:', href)
return
except FileNotFoundError:
self.log.warning('Failed to find image:', href)
return
try: