Skip to content

Commit

Permalink
#196 Don't send unnecessary data to Cortex when an analyze is submitted
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed May 9, 2017
1 parent d9055b8 commit 12e2550
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions thehive-cortex/app/connectors/cortex/services/CortexSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,12 @@ class CortexSrv @Inject() (
case Some(cortex)
for {
artifact artifactSrv.get(artifactId)
artifactAttributes = Json.obj(
"tlp" artifact.tlp(),
"dataType" artifact.dataType())
cortexArtifact = (artifact.data(), artifact.attachment()) match {
case (Some(data), None) DataArtifact(data, artifact.attributes)
case (None, Some(attachment)) FileArtifact(attachmentSrv.source(attachment.id), artifact.attributes)
case (Some(data), None) DataArtifact(data, artifactAttributes)
case (None, Some(attachment)) FileArtifact(attachmentSrv.source(attachment.id), artifactAttributes)
case _ throw InternalError(s"Artifact has invalid data : ${artifact.attributes}")
}
cortexJobJson cortex.analyze(analyzerId, cortexArtifact)
Expand Down

0 comments on commit 12e2550

Please sign in to comment.