woops forgot file, recommit of: more type checking of filesystem json files; added corresponding tests

stix2.0
= 2018-03-14 16:32:31 -04:00
parent af14cd4f88
commit 6f762e7ea0
1 changed files with 2 additions and 1 deletions

View File

@ -313,10 +313,11 @@ class FileSystemSource(DataSource):
if stix_obj["type"] == "bundle":
stix_obj = stix_obj["objects"][0]
# naive STIX check
stix_obj["type"]
stix_obj["id"]
except (UnicodeDecodeError, ValueError, KeyError) as e: # likely not a JSON file
except (ValueError, KeyError) as e: # likely not a JSON file
print("filesytem TypeError raised")
raise TypeError("STIX JSON object at '{0}' could either not be parsed to JSON or was not valid STIX JSON".format(os.path.join(root, file_)))