From 944435fd2f7c7895ff4e82e3438f04f07f701111 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 Jan 2009 15:46:48 -0800 Subject: [PATCH] Fix bug affecting the Tableof COntents in EPUB files generated from PRC files. The generated TOC would cause the SONY reader to crash if the original PRC file contained links to the internet --- src/calibre/ebooks/mobi/reader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/reader.py b/src/calibre/ebooks/mobi/reader.py index 779bdf8067..a5018a7ff2 100644 --- a/src/calibre/ebooks/mobi/reader.py +++ b/src/calibre/ebooks/mobi/reader.py @@ -309,7 +309,8 @@ class MobiReader(object): except: text = '' text = ent_pat.sub(entity_to_unicode, text) - tocobj.add_item(toc.partition('#')[0], a['href'][1:], text) + if a['href'].startswith('#'): + tocobj.add_item(toc.partition('#')[0], a['href'][1:], text) if tocobj is not None: opf.set_toc(tocobj)