mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EPUB Input: Automatically strip entries of type application/text from the spine. Apparently there are EPUB production tools out there that create them. Fixes #884792 (Private bug)
This commit is contained in:
parent
2bc0afd821
commit
8d319b7630
@ -180,7 +180,7 @@ class EPUBInput(InputFormatPlugin):
|
||||
for y in opf.itermanifest():
|
||||
id_ = y.get('id', None)
|
||||
if id_ and y.get('media-type', None) in \
|
||||
('application/vnd.adobe-page-template+xml',):
|
||||
('application/vnd.adobe-page-template+xml','application/text'):
|
||||
not_for_spine.add(id_)
|
||||
|
||||
for x in list(opf.iterspine()):
|
||||
@ -189,6 +189,9 @@ class EPUBInput(InputFormatPlugin):
|
||||
x.getparent().remove(x)
|
||||
continue
|
||||
|
||||
if len(list(opf.iterspine())) == 0:
|
||||
raise ValueError('No valid entries in the spine of this EPUB')
|
||||
|
||||
with open('content.opf', 'wb') as nopf:
|
||||
nopf.write(opf.render())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user