summaryrefslogtreecommitdiff
path: root/libmat2
diff options
context:
space:
mode:
Diffstat (limited to 'libmat2')
-rw-r--r--libmat2/epub.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/libmat2/epub.py b/libmat2/epub.py
index 83f5728..af059d2 100644
--- a/libmat2/epub.py
+++ b/libmat2/epub.py
@@ -1,6 +1,7 @@
1import logging 1import logging
2import re 2import re
3import uuid 3import uuid
4import zipfile
4import xml.etree.ElementTree as ET # type: ignore 5import xml.etree.ElementTree as ET # type: ignore
5from typing import Dict, Any 6from typing import Dict, Any
6 7
@@ -27,7 +28,16 @@ class EPUBParser(archive.ZipParser):
27 })) 28 }))
28 self.uniqid = uuid.uuid4() 29 self.uniqid = uuid.uuid4()
29 30
30 def _specific_get_meta(self, full_path, file_path): 31
32 def is_archive_valid(self):
33 super().is_archive_valid()
34 with zipfile.ZipFile(self.filename) as zin:
35 for item in self._get_all_members(zin):
36 member_name = self._get_member_name(item)
37 if member_name.endswith('META-INF/encryption.xml'):
38 raise ValueError('the file contains encrypted fonts')
39
40 def _specific_get_meta(self, full_path, file_path) -> Dict[str, Any]:
31 if not file_path.endswith('.opf'): 41 if not file_path.endswith('.opf'):
32 return {} 42 return {}
33 43