From 6f762e7ea053ee6db90e91d1da19199307584155 Mon Sep 17 00:00:00 2001 From: = Date: Wed, 14 Mar 2018 16:32:31 -0400 Subject: [PATCH] woops forgot file, recommit of: more type checking of filesystem json files; added corresponding tests --- stix2/datastore/filesystem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stix2/datastore/filesystem.py b/stix2/datastore/filesystem.py index 438e706..35e3a54 100644 --- a/stix2/datastore/filesystem.py +++ b/stix2/datastore/filesystem.py @@ -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_)))