From f8111547ae9e414901f38c8598704a25380cc06c Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 30 Jan 2021 16:24:42 +0100 Subject: [PATCH] Improve epub compatibility --- libmat2/epub.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmat2/epub.py b/libmat2/epub.py index 390ee63..fd38411 100644 --- a/libmat2/epub.py +++ b/libmat2/epub.py @@ -15,11 +15,12 @@ class EPUBParser(archive.ZipParser): 'META-INF/container.xml', 'mimetype', 'OEBPS/content.opf', + 'content.opf', })) self.uniqid = uuid.uuid4() def _specific_get_meta(self, full_path, file_path): - if file_path != 'OEBPS/content.opf': + if not file_path.endswith('content.opf'): return {} with open(full_path, encoding='utf-8') as f: @@ -31,7 +32,7 @@ class EPUBParser(archive.ZipParser): return {file_path: 'harmful content', } 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) elif full_path.endswith('OEBPS/toc.ncx'): return self.__handle_tocncx(full_path)