diff --git a/src/calibre/ebooks/oeb/polish/toc.py b/src/calibre/ebooks/oeb/polish/toc.py index d6a6fadb04..5546481892 100644 --- a/src/calibre/ebooks/oeb/polish/toc.py +++ b/src/calibre/ebooks/oeb/polish/toc.py @@ -468,7 +468,10 @@ def from_links(container): href = a.get('href') if not href or not href.strip(): continue - dest = container.href_to_name(href, base=name) + if href.startswith('#'): + dest = name + else: + dest = container.href_to_name(href, base=name) frag = href.rpartition('#')[-1] or None if (dest, frag) in seen_dests: continue