mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Output: Fix handling of links with URL unsafe characters. Fixes #4091 (convert from HTML to mobipocket, hyperlink do not work anymore)
This commit is contained in:
parent
52f49dcccf
commit
85df3fb0e6
@ -243,7 +243,7 @@ class Serializer(object):
|
|||||||
buffer = self.buffer
|
buffer = self.buffer
|
||||||
if not item.linear:
|
if not item.linear:
|
||||||
self.breaks.append(buffer.tell() - 1)
|
self.breaks.append(buffer.tell() - 1)
|
||||||
self.id_offsets[item.href] = buffer.tell()
|
self.id_offsets[urlnormalize(item.href)] = buffer.tell()
|
||||||
# Kindle periodical articles are contained in a <div> tag
|
# Kindle periodical articles are contained in a <div> tag
|
||||||
buffer.write('<div>')
|
buffer.write('<div>')
|
||||||
for elem in item.data.find(XHTML('body')):
|
for elem in item.data.find(XHTML('body')):
|
||||||
@ -265,7 +265,7 @@ class Serializer(object):
|
|||||||
if id is not None:
|
if id is not None:
|
||||||
href = '#'.join((item.href, id))
|
href = '#'.join((item.href, id))
|
||||||
offset = self.anchor_offset or buffer.tell()
|
offset = self.anchor_offset or buffer.tell()
|
||||||
self.id_offsets[href] = offset
|
self.id_offsets[urlnormalize(href)] = offset
|
||||||
if self.anchor_offset is not None and \
|
if self.anchor_offset is not None and \
|
||||||
tag == 'a' and not elem.attrib and \
|
tag == 'a' and not elem.attrib and \
|
||||||
not len(elem) and not elem.text:
|
not len(elem) and not elem.text:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user