mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Check Book: Do not fail if non-UTF-8 stylesheets are present in the book. Fixes #1866701 [Private bug](https://bugs.launchpad.net/calibre/+bug/1866701)
This commit is contained in:
parent
6e4ed94a6b
commit
0c67299374
@ -48,16 +48,18 @@ def run_checks(container):
|
|||||||
xml_items, html_items, raster_images, stylesheets = [], [], [], []
|
xml_items, html_items, raster_images, stylesheets = [], [], [], []
|
||||||
for name, mt in iteritems(container.mime_map):
|
for name, mt in iteritems(container.mime_map):
|
||||||
items = None
|
items = None
|
||||||
|
decode = False
|
||||||
if mt in XML_TYPES:
|
if mt in XML_TYPES:
|
||||||
items = xml_items
|
items = xml_items
|
||||||
elif mt in OEB_DOCS:
|
elif mt in OEB_DOCS:
|
||||||
items = html_items
|
items = html_items
|
||||||
elif mt in OEB_STYLES:
|
elif mt in OEB_STYLES:
|
||||||
|
decode = True
|
||||||
items = stylesheets
|
items = stylesheets
|
||||||
elif is_raster_image(mt):
|
elif is_raster_image(mt):
|
||||||
items = raster_images
|
items = raster_images
|
||||||
if items is not None:
|
if items is not None:
|
||||||
items.append((name, mt, container.open(name, 'rb').read()))
|
items.append((name, mt, container.raw_data(name, decode=decode)))
|
||||||
errors.extend(run_checkers(check_html_size, html_items))
|
errors.extend(run_checkers(check_html_size, html_items))
|
||||||
errors.extend(run_checkers(check_xml_parsing, xml_items))
|
errors.extend(run_checkers(check_xml_parsing, xml_items))
|
||||||
errors.extend(run_checkers(check_xml_parsing, html_items))
|
errors.extend(run_checkers(check_xml_parsing, html_items))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user