]> source.dussan.org Git - gitea.git/commitdiff
Fix #9151 - smtp logger configuration sendTos should be an array (#9154)
authorzeripath <art27@cantab.net>
Mon, 25 Nov 2019 13:38:57 +0000 (13:38 +0000)
committerGitHub <noreply@github.com>
Mon, 25 Nov 2019 13:38:57 +0000 (13:38 +0000)
* Fix #9151 - sendTos should be an array

* trimspace from the addresses

modules/setting/log.go

index cb8f1420840dd93130a4205fc3b7765656b2e65d..5a54a8688eeee1f6eb84991e08390b9c71edb190 100644 (file)
@@ -131,7 +131,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")
        }