From 4af257b2a6ff536ae5ae3b34b62249c8f3bcaf22 Mon Sep 17 00:00:00 2001 From: Robin Riclet Date: Thu, 11 Feb 2021 16:15:34 +0100 Subject: [PATCH] #1670 Fixed : changing into = when saving a tag --- thehive/app/org/thp/thehive/models/Tag.scala | 11 ++++++----- thehive/app/org/thp/thehive/services/CaseSrv.scala | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/thehive/app/org/thp/thehive/models/Tag.scala b/thehive/app/org/thp/thehive/models/Tag.scala index ee1264f61e..96e74923dc 100644 --- a/thehive/app/org/thp/thehive/models/Tag.scala +++ b/thehive/app/org/thp/thehive/models/Tag.scala @@ -17,10 +17,11 @@ case class Tag( ) { override def hashCode(): Int = 31 * (31 * value.## + predicate.##) + namespace.## - override def equals(obj: Any): Boolean = obj match { - case Tag(n, p, v, _, _) => n == namespace && p == predicate && v == value - case _ => false - } + override def equals(obj: Any): Boolean = + obj match { + case Tag(n, p, v, _, _) => n == namespace && p == predicate && v == value + case _ => false + } override def canEqual(that: Any): Boolean = that.isInstanceOf[Tag] @@ -34,7 +35,7 @@ object Tag { lazy val logger: Logger = Logger(getClass) val tagColour: Regex = "(.*)(#\\p{XDigit}{6})".r val namespacePredicateValue: Regex = "([^\".:=]+)[.:]([^\".=]+)=\"?([^\"]+)\"?".r - val namespacePredicate: Regex = "([^\".:=]+)[.]([^\".=]+)".r + val namespacePredicate: Regex = "([^\".:=]+)[.:]([^\".=]+)".r val PredicateValue: Regex = "([^\".:=]+)[=:]\"?([^\"]+)\"?".r val predicate: Regex = "([^\".:=]+)".r diff --git a/thehive/app/org/thp/thehive/services/CaseSrv.scala b/thehive/app/org/thp/thehive/services/CaseSrv.scala index b0556e5495..664f54104a 100644 --- a/thehive/app/org/thp/thehive/services/CaseSrv.scala +++ b/thehive/app/org/thp/thehive/services/CaseSrv.scala @@ -144,7 +144,7 @@ class CaseSrv @Inject() ( def updateTagNames(`case`: Case with Entity, tags: Set[String])(implicit graph: Graph, authContext: AuthContext): Try[Unit] = tags.toTry(tagSrv.getOrCreate).flatMap(t => updateTags(`case`, t.toSet)) - def updateTags(`case`: Case with Entity, tags: Set[Tag with Entity])(implicit graph: Graph, authContext: AuthContext): Try[Unit] = { + private def updateTags(`case`: Case with Entity, tags: Set[Tag with Entity])(implicit graph: Graph, authContext: AuthContext): Try[Unit] = { val (tagsToAdd, tagsToRemove) = get(`case`) .tags .toIterator