mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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)
This commit is contained in:
parent
ea0432d3fe
commit
24e4e1cf00
@ -15,8 +15,8 @@ from lxml.etree import XPath as _XPath
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
from lxml.cssselect import CSSSelector
|
from lxml.cssselect import CSSSelector
|
||||||
|
|
||||||
from calibre.ebooks.oeb.base import OEB_STYLES, XPNSMAP as NAMESPACES, \
|
from calibre.ebooks.oeb.base import (OEB_STYLES, XPNSMAP as NAMESPACES,
|
||||||
urldefrag, rewrite_links, urlunquote, barename, XHTML
|
urldefrag, rewrite_links, urlunquote, barename, XHTML, urlnormalize)
|
||||||
from calibre.ebooks.epub import rules
|
from calibre.ebooks.epub import rules
|
||||||
|
|
||||||
XPath = functools.partial(_XPath, namespaces=NAMESPACES)
|
XPath = functools.partial(_XPath, namespaces=NAMESPACES)
|
||||||
@ -159,6 +159,7 @@ class Split(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
# Unparseable URL
|
# Unparseable URL
|
||||||
return url
|
return url
|
||||||
|
href = urlnormalize(href)
|
||||||
if href in self.map:
|
if href in self.map:
|
||||||
anchor_map = self.map[href]
|
anchor_map = self.map[href]
|
||||||
nhref = anchor_map[frag if frag else None]
|
nhref = anchor_map[frag if frag else None]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user