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

Commit 7225eab

Browse files
committed
[client-python] fixes
1 parent a9f70f0 commit 7225eab

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

pycti/api/opencti_api_internal_file.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ def __init__(self, api):
55
self.api = api
66

77
def delete(self, **kwargs):
8-
fileName = kwargs.get("fileName", None)
8+
item = kwargs.get("item", None)
9+
fileName = self.api.get_attribute_in_extension("id", item)
910
if fileName is not None:
1011
query = """
1112
mutation InternalFileDelete($fileName: String) {

pycti/utils/opencti_stix2.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,23 +2599,8 @@ def element_operation_delete(self, item, operation):
25992599
else:
26002600
# Element is not knowledge we need to use the right api
26012601
stix_helper = self.get_internal_helper().get(item["type"])
2602-
2603-
self.opencti.app_logger.info(stix_helper)
2604-
self.opencti.app_logger.info(
2605-
"-------- TYPE ----------",
2606-
{"type": item["type"]},
2607-
)
2608-
if item["type"] == "internalfile":
2609-
self.opencti.app_logger.info(
2610-
"-------- internal file ----------",
2611-
{"type": item["type"]},
2612-
)
2613-
self.opencti.app_logger.info(item)
2614-
fileName = self.opencti.get_attribute_in_extension("id", item)
2615-
self.opencti.app_logger.info(fileName)
2616-
stix_helper.delete(fileName=fileName)
2617-
elif stix_helper and hasattr(stix_helper, "delete"):
2618-
stix_helper.delete(id=item["id"])
2602+
if stix_helper and hasattr(stix_helper, "delete"):
2603+
stix_helper.delete(id=item["id"], item=item)
26192604
else:
26202605
raise ValueError(
26212606
"Delete operation or not found stix helper", {"type": item["type"]}

0 commit comments

Comments
 (0)