mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion pipeline: When adding/removing entries to the manifest, ignore unparseable URLs instead of erroring out on them
This commit is contained in:
parent
9cc367ae24
commit
c7ea8f4886
@ -188,8 +188,13 @@ class OEBReader(object):
|
|||||||
href, _ = urldefrag(href)
|
href, _ = urldefrag(href)
|
||||||
if not href:
|
if not href:
|
||||||
continue
|
continue
|
||||||
href = item.abshref(urlnormalize(href))
|
try:
|
||||||
scheme = urlparse(href).scheme
|
href = item.abshref(urlnormalize(href))
|
||||||
|
scheme = urlparse(href).scheme
|
||||||
|
except:
|
||||||
|
self.oeb.log.exception(
|
||||||
|
'Skipping invalid href: %r'%href)
|
||||||
|
continue
|
||||||
if not scheme and href not in known:
|
if not scheme and href not in known:
|
||||||
new.add(href)
|
new.add(href)
|
||||||
elif item.media_type in OEB_STYLES:
|
elif item.media_type in OEB_STYLES:
|
||||||
|
@ -47,7 +47,10 @@ class ManifestTrimmer(object):
|
|||||||
item.data is not None:
|
item.data is not None:
|
||||||
hrefs = [r[2] for r in iterlinks(item.data)]
|
hrefs = [r[2] for r in iterlinks(item.data)]
|
||||||
for href in hrefs:
|
for href in hrefs:
|
||||||
href = item.abshref(urlnormalize(href))
|
try:
|
||||||
|
href = item.abshref(urlnormalize(href))
|
||||||
|
except:
|
||||||
|
continue
|
||||||
if href in oeb.manifest.hrefs:
|
if href in oeb.manifest.hrefs:
|
||||||
found = oeb.manifest.hrefs[href]
|
found = oeb.manifest.hrefs[href]
|
||||||
if found not in used:
|
if found not in used:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user