py3: Fix #1863160 [Wrong links in the converted azw3 file](https://bugs.launchpad.net/calibre/+bug/1863160)

This commit is contained in:
Kovid Goyal 2020-02-16 12:05:46 +05:30
parent 6d4909978a
commit 14a803229f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -16,7 +16,7 @@ from lxml import etree
from calibre import my_unichr from calibre import my_unichr
from calibre.ebooks.oeb.base import XHTML_NS, extract from calibre.ebooks.oeb.base import XHTML_NS, extract
from calibre.ebooks.mobi.utils import to_base, PolyglotDict from calibre.ebooks.mobi.utils import to_base, PolyglotDict
from polyglot.builtins import iteritems, unicode_type from polyglot.builtins import iteritems, unicode_type, as_bytes
CHUNK_SIZE = 8192 CHUNK_SIZE = 8192
@ -397,7 +397,7 @@ class Chunker(object):
pos, fid = to_base(pos, min_num_digits=4), to_href(fid) pos, fid = to_base(pos, min_num_digits=4), to_href(fid)
return ':off:'.join((pos, fid)).encode('utf-8') return ':off:'.join((pos, fid)).encode('utf-8')
placeholder_map = {k:to_placeholder(v) for k, v in placeholder_map = {as_bytes(k):to_placeholder(v) for k, v in
iteritems(self.placeholder_map)} iteritems(self.placeholder_map)}
# Now update the links # Now update the links