This commit is contained in:
Kovid Goyal 2020-10-24 11:34:59 +05:30
parent 73df11e69e
commit 45a4c8c867
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -305,12 +305,12 @@ class HTMLInput(InputFormatPlugin):
def css_import_handler(self, base, href):
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):
return (None, None)
return None, None
try:
with open(link, 'rb') as f:
raw = f.read().decode('utf-8', 'replace')
raw = self.oeb.css_preprocessor(raw, add_namespace=False)
except:
self.log.exception('Failed to read CSS file: %r'%link)
return (None, None)
return (None, raw)
return None, None
return None, raw