From bd7aa63c14b8f8e894bd65d14d889a07623560eb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 Jul 2022 18:45:54 +0530 Subject: [PATCH] Container: handle internal hrefs that result in ValueError when try to resolve them on windows --- src/calibre/ebooks/oeb/polish/container.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index 589eae83c1..4bb53e8bd1 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -118,7 +118,10 @@ def href_to_name(href, root, base=None): # assume all such paths are invalid/absolute paths. return None fullpath = os.path.join(base, *href.split('/')) - return unicodedata.normalize('NFC', abspath_to_name(fullpath, root)) + try: + return unicodedata.normalize('NFC', abspath_to_name(fullpath, root)) + except ValueError: + return None class ContainerBase: # {{{