diff options
| author | Brolf | 2019-02-20 00:45:27 +0100 |
|---|---|---|
| committer | georg | 2019-03-05 23:13:42 +0000 |
| commit | 5ac91cd4f94a822c81bd0bc55a2f7034b31eee7a (patch) | |
| tree | b8e4e9ebb15757d5a6779eb5c224a6f98ba01ead /libmat2/office.py | |
| parent | c3f097a82ba6fd8549aabc9c5427ab4e337fec0e (diff) | |
Refactor {black,white}list into {block,allow}list
Closes #96
Diffstat (limited to 'libmat2/office.py')
| -rw-r--r-- | libmat2/office.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libmat2/office.py b/libmat2/office.py index f3a5b22..2c9cbff 100644 --- a/libmat2/office.py +++ b/libmat2/office.py | |||
| @@ -89,7 +89,7 @@ class MSOfficeParser(ArchiveBasedAbstractParser): | |||
| 89 | r'^word/theme', | 89 | r'^word/theme', |
| 90 | r'^word/people\.xml$', | 90 | r'^word/people\.xml$', |
| 91 | 91 | ||
| 92 | # we have a whitelist in self.files_to_keep, | 92 | # we have an allowlist in self.files_to_keep, |
| 93 | # so we can trash everything else | 93 | # so we can trash everything else |
| 94 | r'^word/_rels/', | 94 | r'^word/_rels/', |
| 95 | })) | 95 | })) |
| @@ -100,7 +100,7 @@ class MSOfficeParser(ArchiveBasedAbstractParser): | |||
| 100 | def __fill_files_to_keep_via_content_types(self) -> bool: | 100 | def __fill_files_to_keep_via_content_types(self) -> bool: |
| 101 | """ There is a suer-handy `[Content_Types].xml` file | 101 | """ There is a suer-handy `[Content_Types].xml` file |
| 102 | in MS Office archives, describing what each other file contains. | 102 | in MS Office archives, describing what each other file contains. |
| 103 | The self.content_types_to_keep member contains a type whitelist, | 103 | The self.content_types_to_keep member contains a type allowlist, |
| 104 | so we're using it to fill the self.files_to_keep one. | 104 | so we're using it to fill the self.files_to_keep one. |
| 105 | """ | 105 | """ |
| 106 | with zipfile.ZipFile(self.filename) as zin: | 106 | with zipfile.ZipFile(self.filename) as zin: |
| @@ -220,7 +220,7 @@ class MSOfficeParser(ArchiveBasedAbstractParser): | |||
| 220 | for file_to_omit in self.files_to_omit: | 220 | for file_to_omit in self.files_to_omit: |
| 221 | if file_to_omit.search(fname): | 221 | if file_to_omit.search(fname): |
| 222 | matches = map(lambda r: r.search(fname), self.files_to_keep) | 222 | matches = map(lambda r: r.search(fname), self.files_to_keep) |
| 223 | if any(matches): # the file is whitelisted | 223 | if any(matches): # the file is in the allowlist |
| 224 | continue | 224 | continue |
| 225 | removed_fnames.add(fname) | 225 | removed_fnames.add(fname) |
| 226 | break | 226 | break |
