mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-04 23:13:37 +02: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
2 changed files with 4 additions and 4 deletions
|
|
@ -180,7 +180,6 @@ def serialize_elem(self, elem, item, nsrmap=NSRMAP):
|
|||
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 @@ def serialize_elem(self, elem, item, nsrmap=NSRMAP):
|
|||
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 @@ def transform(self, oeb, context):
|
|||
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…
Reference in a new issue