woops forgot file, recommit of: more type checking of filesystem json files; added corresponding tests
parent
af14cd4f88
commit
6f762e7ea0
|
@ -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_)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue