From 293771fc1924e51226e6a8d8189f04577c12bf65 Mon Sep 17 00:00:00 2001 From: To-om Date: Thu, 15 Apr 2021 16:59:40 +0200 Subject: [PATCH] #1974 Fix tags field update --- thehive/app/org/thp/thehive/services/ObservableSrv.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/thehive/app/org/thp/thehive/services/ObservableSrv.scala b/thehive/app/org/thp/thehive/services/ObservableSrv.scala index a2e9f0d8cd..915eec1471 100644 --- a/thehive/app/org/thp/thehive/services/ObservableSrv.scala +++ b/thehive/app/org/thp/thehive/services/ObservableSrv.scala @@ -114,9 +114,11 @@ class ObservableSrv @Inject() ( .toSeq .map(_.toString) .toSet + val newTags = tags -- currentTags for { - createdTags <- (tags -- currentTags).filterNot(_.isEmpty).toTry(tagSrv.getOrCreate) + createdTags <- newTags.filterNot(_.isEmpty).toTry(tagSrv.getOrCreate) _ <- createdTags.toTry(observableTagSrv.create(ObservableTag(), observable, _)) + _ <- get(observable).update(_.tags, (currentTags ++ newTags).toSeq).getOrFail("Observable") // _ <- auditSrv.observable.update(observable, Json.obj("tags" -> (currentTags ++ tags))) } yield createdTags }