From 2b257a91def6eb3bd5a5f06263e7c13cd193b8c8 Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 25 Nov 2019 15:18:16 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20#9151=20-=20smtp=20logger=20configuration?= =?UTF-8?q?=20sendTos=20should=20be=20an=20arra=E2=80=A6=20(#9157)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix #9151 - sendTos should be an array * trimspace from the addresses --- modules/setting/log.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/setting/log.go b/modules/setting/log.go index 5e2d2d769d7..2cc95f11b28 100644 --- a/modules/setting/log.go +++ b/modules/setting/log.go @@ -128,7 +128,11 @@ func generateLogConfig(sec *ini.Section, name string, defaults defaultLogOptions logConfig["username"] = sec.Key("USER").MustString("example@example.com") logConfig["password"] = sec.Key("PASSWD").MustString("******") logConfig["host"] = sec.Key("HOST").MustString("127.0.0.1:25") - logConfig["sendTos"] = sec.Key("RECEIVERS").MustString("[]") + sendTos := strings.Split(sec.Key("RECEIVERS").MustString(""), ",") + for i, address := range sendTos { + sendTos[i] = strings.TrimSpace(address) + } + logConfig["sendTos"] = sendTos logConfig["subject"] = sec.Key("SUBJECT").MustString("Diagnostic message from Gitea") }