This commit is contained in:
Kovid Goyal 2012-02-03 09:09:51 +05:30
parent 4b08b70ea2
commit 6062bc3eac

View File

@ -363,6 +363,8 @@ class MobiReader(object):
self.log.warning('MOBI markup appears to contain random bytes. Stripping.')
self.processed_html = self.remove_random_bytes(self.processed_html)
root = fromstring(self.processed_html)
if len(root.xpath('body/descendant::*')) < 1:
raise Exception('Failed to parse the markup in this MOBI file')
if root.tag != 'html':
self.log.warn('File does not have opening <html> tag')