From 2407fca63f73404580683a8057486bbc90cab648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmeet=2Eghodasara=E2=80=9D?= <“meet.ghodasara@crestdatasys.com”> Date: Wed, 6 Nov 2024 17:55:15 +0530 Subject: [PATCH] Resolve time format conflicts between ingested data and STIX object timestamps --- opentaxii/persistence/sqldb/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opentaxii/persistence/sqldb/api.py b/opentaxii/persistence/sqldb/api.py index 4ce29538..5779ef64 100644 --- a/opentaxii/persistence/sqldb/api.py +++ b/opentaxii/persistence/sqldb/api.py @@ -983,6 +983,8 @@ def add_objects( self.db.session.commit() job_details = [] for obj in objects: + if not obj.get("modified"): + obj["modified"] = obj.get("created") or datetime.datetime.now(datetime.timezone.utc).strftime(DATETIMEFORMAT) version = datetime.datetime.strptime( obj["modified"], DATETIMEFORMAT ).replace(tzinfo=datetime.timezone.utc)