mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -155,7 +155,10 @@ class CHMReader(CHMFile):
|
||||
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 @@ class CHMReader(CHMFile):
|
||||
except:
|
||||
pass
|
||||
# do not prettify, it would reformat the <pre> tags!
|
||||
try:
|
||||
return str(soup)
|
||||
except RuntimeError:
|
||||
return data
|
||||
|
||||
def Contents(self):
|
||||
if self._contents is not None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user