mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
EPUB input: Handle books that erroneously set the mimetype for font files to text/plain
This commit is contained in:
parent
e9d7975609
commit
9453d87b38
@ -294,11 +294,22 @@ class EPUBInput(InputFormatPlugin):
|
||||
not_for_spine = set()
|
||||
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/adobe-page-template+xml', 'application/adobe.page-template+xml',
|
||||
'application/text'}:
|
||||
not_for_spine.add(id_)
|
||||
if id_:
|
||||
mt = y.get('media-type', None)
|
||||
if mt in {
|
||||
'application/vnd.adobe-page-template+xml',
|
||||
'application/vnd.adobe.page-template+xml',
|
||||
'application/adobe-page-template+xml',
|
||||
'application/adobe.page-template+xml',
|
||||
'application/text'
|
||||
}:
|
||||
not_for_spine.add(id_)
|
||||
ext = y.get('href', '').rpartition('.')[-1].lower()
|
||||
if mt == 'text/plain' and ext in {'otf', 'ttf'}:
|
||||
# some epub authoring software sets font mime types to
|
||||
# text/plain
|
||||
not_for_spine.add(id_)
|
||||
y.set('media-type', 'application/font')
|
||||
|
||||
seen = set()
|
||||
for x in list(opf.iterspine()):
|
||||
|
Loading…
x
Reference in New Issue
Block a user