diff options
| author | jvoisin | 2021-01-30 16:24:42 +0100 |
|---|---|---|
| committer | jvoisin | 2021-01-30 16:24:42 +0100 |
| commit | f8111547ae9e414901f38c8598704a25380cc06c (patch) | |
| tree | 3acb3c704e830d23a8ce5742e9091d2030b2e733 | |
| parent | 88fa71fbde5880107871bf65861d3206ceac1f4e (diff) | |
Improve epub compatibility
| -rw-r--r-- | libmat2/epub.py | 5 |
1 files 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): | |||
| 15 | 'META-INF/container.xml', | 15 | 'META-INF/container.xml', |
| 16 | 'mimetype', | 16 | 'mimetype', |
| 17 | 'OEBPS/content.opf', | 17 | 'OEBPS/content.opf', |
| 18 | 'content.opf', | ||
| 18 | })) | 19 | })) |
| 19 | self.uniqid = uuid.uuid4() | 20 | self.uniqid = uuid.uuid4() |
| 20 | 21 | ||
| 21 | def _specific_get_meta(self, full_path, file_path): | 22 | def _specific_get_meta(self, full_path, file_path): |
| 22 | if file_path != 'OEBPS/content.opf': | 23 | if not file_path.endswith('content.opf'): |
| 23 | return {} | 24 | return {} |
| 24 | 25 | ||
| 25 | with open(full_path, encoding='utf-8') as f: | 26 | with open(full_path, encoding='utf-8') as f: |
| @@ -31,7 +32,7 @@ class EPUBParser(archive.ZipParser): | |||
| 31 | return {file_path: 'harmful content', } | 32 | return {file_path: 'harmful content', } |
| 32 | 33 | ||
| 33 | def _specific_cleanup(self, full_path: str): | 34 | def _specific_cleanup(self, full_path: str): |
| 34 | if full_path.endswith('OEBPS/content.opf'): | 35 | if full_path.endswith('content.opf'): |
| 35 | return self.__handle_contentopf(full_path) | 36 | return self.__handle_contentopf(full_path) |
| 36 | elif full_path.endswith('OEBPS/toc.ncx'): | 37 | elif full_path.endswith('OEBPS/toc.ncx'): |
| 37 | return self.__handle_tocncx(full_path) | 38 | return self.__handle_tocncx(full_path) |
