AZW3 Output: Dont choke on invalid links in the input document

This commit is contained in:
Kovid Goyal 2013-09-16 19:09:53 +05:30
parent 09af49caa6
commit b72a3f8e79

View File

@ -230,7 +230,11 @@ class KF8Writer(object):
count += 1
ref = item.abshref(a.get('href'))
href, _, frag = ref.partition('#')
try:
href = urlnormalize(href)
except ValueError:
# a non utf-8 quoted url? Since we cannot interpret it, pass it through.
pass
if href in hrefs:
placeholder = 'kindle:pos:fid:0000:off:%s'%to_href(count)
self.link_map[placeholder] = (href, frag)