mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Conversion pipeline: Handle the case where the ncx file is incorrectly given an HTML mimetype
This commit is contained in:
parent
3dc878e911
commit
4ad90f991a
@ -850,6 +850,7 @@ class Manifest(object):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def _parse_xhtml(self, data):
|
def _parse_xhtml(self, data):
|
||||||
|
orig_data = data
|
||||||
self.oeb.log.debug('Parsing', self.href, '...')
|
self.oeb.log.debug('Parsing', self.href, '...')
|
||||||
# Convert to Unicode and normalize line endings
|
# Convert to Unicode and normalize line endings
|
||||||
data = self.oeb.decode(data)
|
data = self.oeb.decode(data)
|
||||||
@ -927,6 +928,8 @@ class Manifest(object):
|
|||||||
|
|
||||||
# Handle weird (non-HTML/fragment) files
|
# Handle weird (non-HTML/fragment) files
|
||||||
if barename(data.tag) != 'html':
|
if barename(data.tag) != 'html':
|
||||||
|
if self.href.endswith('.ncx'):
|
||||||
|
return self._parse_xml(orig_data)
|
||||||
self.oeb.log.warn('File %r does not appear to be (X)HTML'%self.href)
|
self.oeb.log.warn('File %r does not appear to be (X)HTML'%self.href)
|
||||||
nroot = etree.fromstring('<html></html>')
|
nroot = etree.fromstring('<html></html>')
|
||||||
has_body = False
|
has_body = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user