DOCX Output: Fix internal links not working when converted files contain URL unsafe characters in their filenames

This commit is contained in:
Kovid Goyal 2020-04-20 08:45:55 +05:30
parent 63eea9fa35
commit 4b7e24ec46
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -8,6 +8,7 @@ __copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import posixpath, re
from uuid import uuid4
from calibre.ebooks.oeb.base import urlquote
from calibre.utils.filenames import ascii_text
from polyglot.builtins import unicode_type
from polyglot.urllib import urlparse
@ -118,6 +119,8 @@ class LinksManager(object):
if not purl.scheme:
href = item.abshref(href)
if href not in self.document_hrefs:
href = urlquote(href)
if href in self.document_hrefs:
key = (href, purl.fragment or self.top_anchor)
if key in self.anchor_map: