Skip to content

Commit

Permalink
#1556 No MatchError thanks to a Gremlin filter step
Browse files Browse the repository at this point in the history
  • Loading branch information
rriclet authored and To-om committed Oct 28, 2020
1 parent c0283df commit c374028
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions thehive/app/org/thp/thehive/services/AuditSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ object AuditOps {

def richAudit: Traversal[RichAudit, JMap[String, Any], Converter[RichAudit, JMap[String, Any]]] =
traversal
.filter(_.context)
.project(
_.by
.by(_.`case`.entity.fold)
Expand All @@ -312,6 +313,7 @@ object AuditOps {
entityRenderer: Traversal.V[Audit] => Traversal[D, G, C]
): Traversal[(RichAudit, D), JMap[String, Any], Converter[(RichAudit, D), JMap[String, Any]]] =
traversal
.filter(_.context)
.project(
_.by
.by(_.`case`.entity.fold)
Expand All @@ -320,10 +322,9 @@ object AuditOps {
.by(entityRenderer)
)
.domainMap {
case (audit, context, visibilityContext, obj, renderedObject) if context.nonEmpty || visibilityContext.nonEmpty =>
case (audit, context, visibilityContext, obj, renderedObject) =>
val ctx = if (context.isEmpty) visibilityContext.head else context.head
RichAudit(audit, ctx, visibilityContext.head, obj.headOption) -> renderedObject
// case otherwise // FIXME
}

// def forCase(caseId: String): Traversal.V[Audit] = traversal.filter(_.`case`.hasId(caseId))
Expand Down

0 comments on commit c374028

Please sign in to comment.