Skip to content

Commit

Permalink
#53 remove html extension in report template zip package
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Dec 12, 2016
1 parent b6c3f8b commit d4bd9b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CortexClient(val name: String, baseUrl: String, key: String) {
lazy val logger = Logger(getClass)

logger.info(s"new Cortex($name, $baseUrl, $key)")
def request[A](uri: String, f: WSRequest Future[WSResponse], t: WSResponse A)(implicit ws: WSClient, ec: ExecutionContext) = {
def request[A](uri: String, f: WSRequest Future[WSResponse], t: WSResponse A)(implicit ws: WSClient, ec: ExecutionContext): Future[A] = {
val url = (baseUrl + uri)
logger.info(s"Requesting Cortex $url")
f(ws.url(url).withHeaders("auth" key)).map {
Expand Down
4 changes: 3 additions & 1 deletion thehive-cortex/app/controllers/ReportTemplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ class ReportTemplateCtrl @Inject() (
}
val importedReportTemplates: Seq[Future[(String, JsBoolean)]] = zipFile.getFileHeaders.toSeq.filter(_ != null).collect {
case fileHeader: FileHeader if !fileHeader.isDirectory
val Array(analyzerId, flavor, _*) = (fileHeader.getFileName + "/").split("/", 3)
val Array(analyzerId, flavorHtml, _*) = (fileHeader.getFileName + "/").split("/", 3)
val inputStream = zipFile.getInputStream(fileHeader)
val content = Source.fromInputStream(inputStream).mkString
inputStream.close()

val flavor = if (flavorHtml.endsWith(".html")) flavorHtml.dropRight(5) else flavorHtml

val reportTemplateFields = Fields.empty
.set("flavor", flavor)
.set("analyzers", analyzerId)
Expand Down

0 comments on commit d4bd9b2

Please sign in to comment.