AZW3 Input: Fix rare AID based links not working. Fixes #1898394 [Error generating TOC on AZW3 format](https://bugs.launchpad.net/calibre/+bug/1898394)

This commit is contained in:
Kovid Goyal 2020-12-21 10:58:14 +05:30
parent 6b10773c24
commit 26998b0a59
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 2 deletions

View File

@ -335,7 +335,7 @@ def expand_mobi8_markup(mobi8_reader, resource_map, log):
parts = update_internal_links(mobi8_reader, log)
# Remove pointless markup inserted by kindlegen
remove_kindlegen_markup(parts, mobi8_reader.aid_anchor_suffix, mobi8_reader.linked_aids)
remove_kindlegen_markup(parts, mobi8_reader.aid_anchor_suffix.decode('utf-8'), mobi8_reader.linked_aids)
# Handle substitutions for the flows pieces first as they may
# be inlined into the xhtml text

View File

@ -337,7 +337,7 @@ class Mobi8Reader(object):
# See https://www.mobileread.com/forums/showthread.php?t=259557
m = self.aid_re.match(tag)
if m is not None:
self.linked_aids.add(m.group(1))
self.linked_aids.add(m.group(1).decode('utf-8'))
return m.group(1) + b'-' + self.aid_anchor_suffix
# No tag found, link to start of file