EPUB Input: Handle invalid EPUB files that have their NCX documents in the spine. Fixes #1796497 [AttributeError: 'NoneType' object has no attribute 'get'](https://bugs.launchpad.net/calibre/+bug/1796497)

This commit is contained in:
Kovid Goyal 2018-11-08 09:52:30 +05:30
parent a616a092b2
commit dc636725fa
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -337,7 +337,7 @@ class OEBReader(object):
self.logger.warn(u'Spine item %r not found' % idref)
continue
item = manifest.ids[idref]
if item.media_type.lower() in OEB_DOCS and hasattr(item.data, 'xpath'):
if item.media_type.lower() in OEB_DOCS and hasattr(item.data, 'xpath') and not getattr(item.data, 'tag', '').endswith('}ncx'):
spine.add(item, elem.get('linear'))
else:
if hasattr(item.data, 'tag') and item.data.tag and item.data.tag.endswith('}html'):