From 7bb3d1f6a64ef18a8e7480a54f587af34117365e Mon Sep 17 00:00:00 2001 From: Michael Chisholm Date: Tue, 6 Nov 2018 16:06:26 -0500 Subject: [PATCH] Fix FileSystemSource.get() to not look for the latest version of an object when markings are queried, since markings are not versioned. --- stix2/datastore/filesystem.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stix2/datastore/filesystem.py b/stix2/datastore/filesystem.py index a07754a..95c9050 100644 --- a/stix2/datastore/filesystem.py +++ b/stix2/datastore/filesystem.py @@ -529,7 +529,12 @@ class FileSystemSource(DataSource): all_data = self.all_versions(stix_id, version=version, _composite_filters=_composite_filters) if all_data: - stix_obj = sorted(all_data, key=lambda k: k['modified'])[-1] + if is_marking(stix_id): + # Markings are unversioned; there shouldn't be more than one + # result. + stix_obj = all_data[0] + else: + stix_obj = sorted(all_data, key=lambda k: k['modified'])[-1] else: stix_obj = None