mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion: Ignore un-parseable links when trying to generate ToC from links, instead of aborting the conversion. Fixes #1383365 [Ipv6 error when converting PDF to MOBI](https://bugs.launchpad.net/calibre/+bug/1383365)
This commit is contained in:
parent
d2df60ebce
commit
384054e2b9
@ -206,7 +206,11 @@ class DetectStructure(object):
|
||||
for item in self.oeb.spine:
|
||||
for a in XPath('//h:a[@href]')(item.data):
|
||||
href = a.get('href')
|
||||
try:
|
||||
purl = urlparse(href)
|
||||
except ValueError:
|
||||
self.log.warning('Ignoring malformed URL:', href)
|
||||
continue
|
||||
if not purl[0] or purl[0] == 'file':
|
||||
href, frag = purl.path, purl.fragment
|
||||
href = item.abshref(href)
|
||||
|
Loading…
x
Reference in New Issue
Block a user