mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix #1649:
- Handle empty XML files while manifest trimming - Ignore <img/>s with non OPS raster image @src
This commit is contained in:
parent
1a98b0c266
commit
7e63bc95e2
@ -180,7 +180,6 @@ class Serializer(object):
|
||||
if not isinstance(elem.tag, basestring) \
|
||||
or namespace(elem.tag) not in nsrmap:
|
||||
return
|
||||
hrefs = self.oeb.manifest.hrefs
|
||||
tag = prefixname(elem.tag, nsrmap)
|
||||
for attr in ('name', 'id'):
|
||||
if attr in elem.attrib:
|
||||
@ -203,7 +202,7 @@ class Serializer(object):
|
||||
continue
|
||||
elif attr == 'src':
|
||||
href = item.abshref(val)
|
||||
if href in hrefs:
|
||||
if href in self.images:
|
||||
index = self.images[href]
|
||||
buffer.write('recindex="%05d"' % index)
|
||||
continue
|
||||
|
@ -41,8 +41,9 @@ class ManifestTrimmer(object):
|
||||
while unchecked:
|
||||
new = set()
|
||||
for item in unchecked:
|
||||
if item.media_type in OEB_DOCS or \
|
||||
item.media_type[-4:] in ('/xml', '+xml'):
|
||||
if (item.media_type in OEB_DOCS or
|
||||
item.media_type[-4:] in ('/xml', '+xml')) and \
|
||||
item.data is not None:
|
||||
hrefs = [sel(item.data) for sel in LINK_SELECTORS]
|
||||
for href in chain(*hrefs):
|
||||
href = item.abshref(href)
|
||||
|
Loading…
x
Reference in New Issue
Block a user