Skip to content

Commit

Permalink
#1670 Fixed : changing into = when saving a tag
Browse files Browse the repository at this point in the history
  • Loading branch information
rriclet committed Feb 12, 2021
1 parent c66164f commit 4af257b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions thehive/app/org/thp/thehive/models/Tag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/services/CaseSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4af257b

Please sign in to comment.