diff --git a/thehive/app/org/thp/thehive/controllers/v0/Conversion.scala b/thehive/app/org/thp/thehive/controllers/v0/Conversion.scala index 3d919fc09c..babf09ca4f 100644 --- a/thehive/app/org/thp/thehive/controllers/v0/Conversion.scala +++ b/thehive/app/org/thp/thehive/controllers/v0/Conversion.scala @@ -187,7 +187,7 @@ object Conversion { def withCaseTemplate(caseTemplate: RichCaseTemplate): InputCase = InputCase( - title = caseTemplate.titlePrefix.fold("")(_.replaceAll("(?m)\\s*$", " ")) + inputCase.title, + title = caseTemplate.titlePrefix.fold("")(_.replaceAll("(?m)\\s+$", "") + " ") + inputCase.title, description = inputCase.description, severity = inputCase.severity orElse caseTemplate.severity, startDate = inputCase.startDate, diff --git a/thehive/app/org/thp/thehive/controllers/v1/Conversion.scala b/thehive/app/org/thp/thehive/controllers/v1/Conversion.scala index 7ed5da52f9..d583b9171e 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/Conversion.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/Conversion.scala @@ -133,7 +133,7 @@ object Conversion { def withCaseTemplate(caseTemplate: RichCaseTemplate): InputCase = InputCase( - title = caseTemplate.titlePrefix.fold("")(_.replaceAll("(?m)\\s*$", " ")) + inputCase.title, + title = caseTemplate.titlePrefix.fold("")(_.replaceAll("(?m)\\s+$", "") + " ") + inputCase.title, description = inputCase.description, severity = inputCase.severity orElse caseTemplate.severity, startDate = inputCase.startDate,