diff --git a/src/calibre/ebooks/conversion/plugins/epub_input.py b/src/calibre/ebooks/conversion/plugins/epub_input.py index e19d466659..bb60412e1b 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_input.py +++ b/src/calibre/ebooks/conversion/plugins/epub_input.py @@ -211,8 +211,7 @@ class EPUBInput(InputFormatPlugin): cover_toc_item = item break spine = {x.href for x in oeb.spine} - if (cover_toc_item is not None and cover_toc_item.count() == 0 and - cover_toc_item not in spine): + if (cover_toc_item is not None and cover_toc_item not in spine): oeb.toc.item_that_refers_to_cover = cover_toc_item diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 8d523f431a..615ea521d8 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -1015,7 +1015,7 @@ OptionRecommendation(name='search_replace', # Remove the toc reference to the html cover, if any, except for # epub, as the epub output plugin will do the right thing with it. item = getattr(self.oeb.toc, 'item_that_refers_to_cover', None) - if item is not None: + if item is not None and item.count() == 0: self.oeb.toc.remove(item) from calibre.ebooks.oeb.transforms.flatcss import CSSFlattener