Skip to content
Snippets Groups Projects
Commit f8111547 authored by Julien (jvoisin) Voisin's avatar Julien (jvoisin) Voisin
Browse files

Improve epub compatibility

parent 88fa71fb
No related branches found
No related tags found
No related merge requests found
...@@ -15,11 +15,12 @@ class EPUBParser(archive.ZipParser): ...@@ -15,11 +15,12 @@ class EPUBParser(archive.ZipParser):
'META-INF/container.xml', 'META-INF/container.xml',
'mimetype', 'mimetype',
'OEBPS/content.opf', 'OEBPS/content.opf',
'content.opf',
})) }))
self.uniqid = uuid.uuid4() self.uniqid = uuid.uuid4()
def _specific_get_meta(self, full_path, file_path): def _specific_get_meta(self, full_path, file_path):
if file_path != 'OEBPS/content.opf': if not file_path.endswith('content.opf'):
return {} return {}
with open(full_path, encoding='utf-8') as f: with open(full_path, encoding='utf-8') as f:
...@@ -31,7 +32,7 @@ class EPUBParser(archive.ZipParser): ...@@ -31,7 +32,7 @@ class EPUBParser(archive.ZipParser):
return {file_path: 'harmful content', } return {file_path: 'harmful content', }
def _specific_cleanup(self, full_path: str): def _specific_cleanup(self, full_path: str):
if full_path.endswith('OEBPS/content.opf'): if full_path.endswith('content.opf'):
return self.__handle_contentopf(full_path) return self.__handle_contentopf(full_path)
elif full_path.endswith('OEBPS/toc.ncx'): elif full_path.endswith('OEBPS/toc.ncx'):
return self.__handle_tocncx(full_path) return self.__handle_tocncx(full_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment