mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -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()
|
not_for_spine = set()
|
||||||
for y in opf.itermanifest():
|
for y in opf.itermanifest():
|
||||||
id_ = y.get('id', None)
|
id_ = y.get('id', None)
|
||||||
if id_ and y.get('media-type', None) in {
|
if id_:
|
||||||
'application/vnd.adobe-page-template+xml', 'application/vnd.adobe.page-template+xml',
|
mt = y.get('media-type', None)
|
||||||
'application/adobe-page-template+xml', 'application/adobe.page-template+xml',
|
if mt in {
|
||||||
'application/text'}:
|
'application/vnd.adobe-page-template+xml',
|
||||||
not_for_spine.add(id_)
|
'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()
|
seen = set()
|
||||||
for x in list(opf.iterspine()):
|
for x in list(opf.iterspine()):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user