Open KnugiHK opened 2 months ago
For extract_files
function, the default values of relative_paths_like
and domain_like
can acutally be set to "%". By doing so, no checking is needed. The following is the diff of the change:
- def extract_files(self, *, relative_paths_like=None, domain_like=None, output_folder,
+ def extract_files(self, *, relative_paths_like="%", domain_like="%", output_folder,
preserve_folders=False, domain_subfolders=False, incremental=False,
filter_callback=None):
"""
@@ -333,14 +333,6 @@ class EncryptedBackup:
# Ensure that we've initialised everything:
if self._temp_manifest_db_conn is None:
self._decrypt_manifest_db_file()
- # Check the provided arguments and replace missing ones with wildcards:
- if relative_paths_like is None and domain_like is None:
- # If someone _really_ wants to try and extract everything, then setting both to '%' should be enough.
- raise ValueError("At least one of 'relative_paths_like' or 'domain_like' must be specified!")
- elif relative_paths_like is None and domain_like is not None:
- relative_paths_like = "%"
- elif relative_paths_like is not None and domain_like is None:
- domain_like = "%"
# If the filter function is not provided, default to including everything:
_include_fn = filter_callback if callable(filter_callback) else (lambda **kwargs: True)
# Use Manifest.db to find the on-disk filename(s) and file metadata, including the keys, for the file(s).
I can add this commit to the PR if you want.
This PR makes two changes:
Make
relative_paths_like
OptionalBased on the validation logic in the
extract_files
function:The
relative_paths_like
parameter appears to be optional (at least it seems to me that). Thus, it should be set to None by default.Allow Custom Decryption Chunk Size
I found the default chunk size (100MB) drives the decryption process very slow, especially when dealing with a lot of WhatsApp media files. Therefore, a parameter has been added to the
EncryptedBackup
class for adjusting the chunk size.