From b055c70cb532cf9a2ea2529ae83671e958dd10de Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 27 Dec 2014 09:34:12 +0530 Subject: [PATCH] MOBI Input: Fix incorrect conversion of MOBI files that wrap their content inside anchor tags. Fixes #1405858 [A mobi file will not display or convert properly](https://bugs.launchpad.net/calibre/+bug/1405858) --- src/calibre/ebooks/mobi/reader/mobi6.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/reader/mobi6.py b/src/calibre/ebooks/mobi/reader/mobi6.py index ba735944c3..384552d2c1 100644 --- a/src/calibre/ebooks/mobi/reader/mobi6.py +++ b/src/calibre/ebooks/mobi/reader/mobi6.py @@ -525,7 +525,7 @@ class MobiReader(object): except ValueError: pass if (tag.tag == 'a' and attrib.get('id', '').startswith('filepos') - and not tag.text and (tag.tail is None or not + and not tag.text and len(tag) == 0 and (tag.tail is None or not tag.tail.strip()) and getattr(tag.getnext(), 'tag', None) in BLOCK_TAGS): # This is an empty anchor immediately before a block tag, move