mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
73df11e69e
commit
45a4c8c867
@ -305,12 +305,12 @@ class HTMLInput(InputFormatPlugin):
|
|||||||
def css_import_handler(self, base, href):
|
def css_import_handler(self, base, href):
|
||||||
link, frag = self.link_to_local_path(href, base=base)
|
link, frag = self.link_to_local_path(href, base=base)
|
||||||
if link is None or not os.access(link, os.R_OK) or os.path.isdir(link):
|
if link is None or not os.access(link, os.R_OK) or os.path.isdir(link):
|
||||||
return (None, None)
|
return None, None
|
||||||
try:
|
try:
|
||||||
with open(link, 'rb') as f:
|
with open(link, 'rb') as f:
|
||||||
raw = f.read().decode('utf-8', 'replace')
|
raw = f.read().decode('utf-8', 'replace')
|
||||||
raw = self.oeb.css_preprocessor(raw, add_namespace=False)
|
raw = self.oeb.css_preprocessor(raw, add_namespace=False)
|
||||||
except:
|
except:
|
||||||
self.log.exception('Failed to read CSS file: %r'%link)
|
self.log.exception('Failed to read CSS file: %r'%link)
|
||||||
return (None, None)
|
return None, None
|
||||||
return (None, raw)
|
return None, raw
|
||||||
|
Loading…
x
Reference in New Issue
Block a user