diff --git a/src/calibre/ebooks/chm/reader.py b/src/calibre/ebooks/chm/reader.py index 056b180fd3..28d7f1e7c7 100644 --- a/src/calibre/ebooks/chm/reader.py +++ b/src/calibre/ebooks/chm/reader.py @@ -156,7 +156,8 @@ class CHMReader(CHMFile): break if self.hhc_path not in files and files: for f in files: - if f.partition('.')[-1].lower() in {'html', 'htm'}: + if f.partition('.')[-1].lower() in {'html', 'htm', 'xhtm', + 'xhtml'}: self.hhc_path = f break @@ -168,6 +169,9 @@ class CHMReader(CHMFile): self.hhc_path = os.path.relpath(x, output_dir) break + if self.hhc_path not in files and files: + self.hhc_path = files[0] + def _reformat(self, data, htmlpath): if self.input_encoding: data = data.decode(self.input_encoding)