I am currently working on an artifact plugin for a chat app. I am trying to avoid having too permissive of a regex path search (in my case: /private/var/mobile/Containers/Shared/AppGroup/{GUID}/Attachments/{FILES}). I figured I would use Context.seeker.search() to get my attachments so I could avoid bringing in every app that has an Attachments folder. The problem is check_in_media() cannot be used with files that are not found as part of the initial regex path search in the artifact header dict. Any files found manually by calling seeker.search() don't get added to the Context's _files_found or _filename_lookup_map. check_in_media() and _check_in_media() both use: Context.get_source_file_path({path}).
I created a new static method in Context.py that I can pass the results from seeker.search() into for testing, which allowed me to make use of check_in_media() and my artifact results appear as expected in the table view and conversation view (LAVA).
@staticmethod
def add_files_to_context(new_files):
if not isinstance(new_files, list):
new_files = [new_files]
Context._files_found.extend(new_files)
Context._filename_lookup_map = {}
I don't know the best way to tackle this problem. I'm not sure if adding something to the Context is best, some change to the Media Manager would be better, or if I'm missing some other existing way to handle this.
I am currently working on an artifact plugin for a chat app. I am trying to avoid having too permissive of a regex path search (in my case: /private/var/mobile/Containers/Shared/AppGroup/{GUID}/Attachments/{FILES}). I figured I would use
Context.seeker.search()to get my attachments so I could avoid bringing in every app that has an Attachments folder. The problem ischeck_in_media()cannot be used with files that are not found as part of the initial regex path search in the artifact header dict. Any files found manually by callingseeker.search()don't get added to the Context's_files_foundor_filename_lookup_map.check_in_media()and_check_in_media()both use:Context.get_source_file_path({path}).I created a new static method in Context.py that I can pass the results from
seeker.search()into for testing, which allowed me to make use ofcheck_in_media()and my artifact results appear as expected in the table view and conversation view (LAVA).I don't know the best way to tackle this problem. I'm not sure if adding something to the Context is best, some change to the Media Manager would be better, or if I'm missing some other existing way to handle this.