mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-24 18:35:48 +01:00
EPUB Input: Handle empty XML files. Fixes #4705 (epub to mobi conversion fails)
This commit is contained in:
parent
ad4715cb03
commit
b1b291007c
1 changed files with 2 additions and 0 deletions
|
|
@ -760,6 +760,8 @@ def __repr__(self):
|
|||
|
||||
def _parse_xml(self, data):
|
||||
data = xml_to_unicode(data, strip_encoding_pats=True)[0]
|
||||
if not data:
|
||||
return None
|
||||
parser = etree.XMLParser(recover=True)
|
||||
try:
|
||||
return etree.fromstring(data, parser=parser)
|
||||
|
|
|
|||
Loading…
Reference in a new issue