filesystem list comps

stix2.1
= 2017-10-04 09:47:18 -04:00
parent 616ec6bbeb
commit 5789fbce20
1 changed files with 2 additions and 4 deletions

View File

@ -279,13 +279,11 @@ class FileSystemSource(DataSource):
# since ID is specified in one of filters, can evaluate against filename first without loading
stix_obj = json.load(open(os.path.join(root, file_)))["objects"][0]
# check against other filters, add if match
matches = list(apply_common_filters([stix_obj], query))
all_data.extend(matches)
all_data.extend(apply_common_filters([stix_obj], query))
else:
# have to load into memory regardless to evaluate other filters
stix_obj = json.load(open(os.path.join(root, file_)))["objects"][0]
matches = list(apply_common_filters([stix_obj], query))
all_data.extend(matches)
all_data.extend(apply_common_filters([stix_obj], query))
all_data = deduplicate(all_data)