Skip to content

Commit

Permalink
[socprime] Fix the connector crashing when sending empty bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
vu-socprime authored Mar 6, 2023
1 parent 767863e commit b189927
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions external-import/socprime/src/socprime/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,24 +355,20 @@ def send_rules_from_tdm(self, work_id: str) -> None:
self._send_stix_objects(objects_list=bundle_objects, work_id=work_id)

def _send_stix_objects(self, objects_list: list, work_id: str) -> None:
bundle = Bundle(
objects=[
x
for x in objects_list
if not isinstance(x, self._stix_object_types_to_udate)
]
).serialize()
if bundle:
objects = [
x
for x in objects_list
if not isinstance(x, self._stix_object_types_to_udate)
]
if objects:
bundle = Bundle(objects=objects).serialize()
self.helper.send_stix2_bundle(bundle, update=False, work_id=work_id)

bundle = Bundle(
objects=[
x
for x in objects_list
if isinstance(x, self._stix_object_types_to_udate)
]
).serialize()
if bundle:
objects = [
x for x in objects_list if isinstance(x, self._stix_object_types_to_udate)
]
if objects:
bundle = Bundle(objects=objects).serialize()
self.helper.send_stix2_bundle(bundle, update=True, work_id=work_id)

def run(self):
Expand Down

0 comments on commit b189927

Please sign in to comment.