diff --git a/stix2/datastore/filesystem.py b/stix2/datastore/filesystem.py index 26d0c58..a00c6e1 100644 --- a/stix2/datastore/filesystem.py +++ b/stix2/datastore/filesystem.py @@ -303,7 +303,11 @@ class FileSystemSource(DataSource): for file_ in files: if not id_ or id_ == file_.split(".")[0]: # have to load into memory regardless to evaluate other filters - stix_obj = json.load(open(os.path.join(root, file_))) + try: + stix_obj = json.load(open(os.path.join(root, file_))) + except UnicodeDecodeError: # likely not a JSON file + # TODO: log a warning somehow? (os.path.abspath(file_))) + continue if stix_obj.get('type', '') == 'bundle': stix_obj = stix_obj['objects'][0] # check against other filters, add if match