Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 428c29d

Browse files
committed
[client] Handle more marking definition formats
1 parent 3da40c9 commit 428c29d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

pycti/entities/opencti_marking_definition.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ def update_field(self, **kwargs):
236236
def import_from_stix2(self, **kwargs):
237237
stix_object = kwargs.get("stixObject", None)
238238
update = kwargs.get("update", False)
239-
240239
if stix_object is not None:
241240
definition = None
242241
definition_type = stix_object["definition_type"]
@@ -250,9 +249,17 @@ def import_from_stix2(self, **kwargs):
250249
definition = stix_object["name"]
251250
else:
252251
if "definition" in stix_object:
253-
definition = stix_object["definition"][
254-
stix_object["definition_type"]
255-
]
252+
if isinstance(stix_object["definition"], str):
253+
definition = stix_object["definition"]
254+
elif (
255+
isinstance(stix_object["definition"], dict)
256+
and stix_object["definition_type"] in stix_object["definition"]
257+
):
258+
definition = stix_object["definition"][
259+
stix_object["definition_type"]
260+
]
261+
else:
262+
definition = stix_object["name"]
256263
elif "name" in stix_object:
257264
definition = stix_object["name"]
258265

0 commit comments

Comments
 (0)