From 9bde700ea164ed74d07696b8e56447c5f7c7bd35 Mon Sep 17 00:00:00 2001 From: Amit Uniyal Date: Wed, 4 Sep 2024 13:28:16 +0530 Subject: [PATCH] Fixes extra newline from confs As we are using templates to dynamicaly create confs on conditions, Often extra newlines are getting added in confs, we should remove them. --- modules/common/util/template_util.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/common/util/template_util.go b/modules/common/util/template_util.go index a641bb89..f1b00b69 100644 --- a/modules/common/util/template_util.go +++ b/modules/common/util/template_util.go @@ -157,6 +157,8 @@ func ExecuteTemplateData(templateData string, data interface{}) (string, error) "add": add, "lower": lower, } + // remove extra newlines + templateData = strings.ReplaceAll(templateData, "\n\n\n", "") tmpl, err := template.New("tmp").Option("missingkey=error").Funcs(funcs).Parse(templateData) if err != nil { return "", err