From 24e4e1cf0027a8443c4d27901575f9989b63c94a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 12 Feb 2012 12:00:11 +0530 Subject: [PATCH] EPUB Output: Fix splitting breaking internal links in the epub, if the links pointed to files with URL unsafe characters in their file names. Fixes #929966 (HTML links break when converting epub to epub) --- src/calibre/ebooks/oeb/transforms/split.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/transforms/split.py b/src/calibre/ebooks/oeb/transforms/split.py index 96e4b08079..8d826b9963 100644 --- a/src/calibre/ebooks/oeb/transforms/split.py +++ b/src/calibre/ebooks/oeb/transforms/split.py @@ -15,8 +15,8 @@ from lxml.etree import XPath as _XPath from lxml import etree from lxml.cssselect import CSSSelector -from calibre.ebooks.oeb.base import OEB_STYLES, XPNSMAP as NAMESPACES, \ - urldefrag, rewrite_links, urlunquote, barename, XHTML +from calibre.ebooks.oeb.base import (OEB_STYLES, XPNSMAP as NAMESPACES, + urldefrag, rewrite_links, urlunquote, barename, XHTML, urlnormalize) from calibre.ebooks.epub import rules XPath = functools.partial(_XPath, namespaces=NAMESPACES) @@ -159,6 +159,7 @@ class Split(object): except ValueError: # Unparseable URL return url + href = urlnormalize(href) if href in self.map: anchor_map = self.map[href] nhref = anchor_map[frag if frag else None]