From 809ed8ec48b3dee7a77b1e66a55d9ca23a108f57 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 18 Aug 2015 08:16:54 +0530 Subject: [PATCH] Edit Book: Check Book: Fix incorrect links that consist only of an anchor and no filename not being detected. Fixes #1485670 [Editor: Check book tool fails to check "#anchor" links](https://bugs.launchpad.net/calibre/+bug/1485670) --- src/calibre/ebooks/oeb/polish/check/links.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/oeb/polish/check/links.py b/src/calibre/ebooks/oeb/polish/check/links.py index 997be4bb8f..46d639e5c0 100644 --- a/src/calibre/ebooks/oeb/polish/check/links.py +++ b/src/calibre/ebooks/oeb/polish/check/links.py @@ -213,10 +213,13 @@ def check_mimetypes(container): return errors def check_link_destination(container, dest_map, name, href, a, errors): - try: - tname = container.href_to_name(href, name) - except ValueError: - tname = None # Absolute links to files on another drive in windows cause this + if href.startswith('#'): + tname = name + else: + try: + tname = container.href_to_name(href, name) + except ValueError: + tname = None # Absolute links to files on another drive in windows cause this if tname and tname in container.mime_map: if container.mime_map[tname] not in OEB_DOCS: errors.append(BadDestinationType(name, tname, a))