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

Commit 60943c5

Browse files
author
Samuel Hassine
committed
[client] Fix upload
1 parent 5ba9076 commit 60943c5

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

pycti/api/opencti_api_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,10 @@ def upload_file(self, **kwargs):
525525
"""
526526
if data is None:
527527
data = open(file_name, "rb")
528-
mime_type = magic.from_file(file_name, mime=True)
528+
if file_name.endswith(".json"):
529+
mime_type = "application/json"
530+
else:
531+
mime_type = magic.from_file(file_name, mime=True)
529532

530533
return self.query(query, {"file": (File(file_name, data, mime_type))})
531534
else:

pycti/entities/opencti_stix_domain_object.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,10 @@ def add_file(self, **kwargs):
626626
"""
627627
if data is None:
628628
data = open(file_name, "rb")
629-
mime_type = magic.from_file(file_name, mime=True)
629+
if file_name.endswith(".json"):
630+
mime_type = "application/json"
631+
else:
632+
mime_type = magic.from_file(file_name, mime=True)
630633

631634
return self.opencti.query(
632635
query,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from setuptools import setup
66
from setuptools.command.install import install
77

8-
VERSION = "4.0.4"
8+
VERSION = "4.0.5"
99

1010
with open("README.md", "r") as fh:
1111
long_description = fh.read()

0 commit comments

Comments
 (0)