mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-28 20:04:23 +01:00
CHM Input: Handle files with deeply nested markup and non html files listed at the start of the manifest. Fixes #993607 (chm to mobi conversion crashes with "maximum recursion depth exceeded")
This commit is contained in:
parent
226a26d208
commit
21c84615de
1 changed files with 8 additions and 2 deletions
|
|
@ -155,7 +155,10 @@ def ExtractFiles(self, output_dir=os.getcwdu(), debug_dump=False):
|
|||
self.hhc_path = f
|
||||
break
|
||||
if self.hhc_path not in files and files:
|
||||
self.hhc_path = files[0]
|
||||
for f in files:
|
||||
if f.partition('.')[-1].lower() in {'html', 'htm'}:
|
||||
self.hhc_path = f
|
||||
break
|
||||
|
||||
if self.hhc_path == '.hhc' and self.hhc_path not in files:
|
||||
from calibre import walk
|
||||
|
|
@ -241,7 +244,10 @@ def _reformat(self, data, htmlpath):
|
|||
except:
|
||||
pass
|
||||
# do not prettify, it would reformat the <pre> tags!
|
||||
return str(soup)
|
||||
try:
|
||||
return str(soup)
|
||||
except RuntimeError:
|
||||
return data
|
||||
|
||||
def Contents(self):
|
||||
if self._contents is not None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue