Conversion pipeline: When adding/removing entries to the manifest, ignore unparseable URLs instead of erroring out on them

This commit is contained in:
Kovid Goyal 2011-07-19 09:50:02 -06:00
parent 9cc367ae24
commit c7ea8f4886
2 changed files with 11 additions and 3 deletions

View File

@ -188,8 +188,13 @@ class OEBReader(object):
href, _ = urldefrag(href)
if not href:
continue
try:
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:
new.add(href)
elif item.media_type in OEB_STYLES:

View File

@ -47,7 +47,10 @@ class ManifestTrimmer(object):
item.data is not None:
hrefs = [r[2] for r in iterlinks(item.data)]
for href in hrefs:
try:
href = item.abshref(urlnormalize(href))
except:
continue
if href in oeb.manifest.hrefs:
found = oeb.manifest.hrefs[href]
if found not in used: