From 16d2cf05ab691adb839e2d979a25285764111f7e Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 13 Apr 2023 00:16:40 +0800 Subject: [PATCH] Fix custom mailer template on Windows (#24081) Fix #24075 Fix #23873 From the log: ``` 2023/04/02 19:41:46 .../templates/mailer.go:68:1() [T] Adding mailer template for \issue\default from "C:\gitea\custom\templates\mail\issue\default.tmpl" ``` That `assetName ` on Windows is wrong. Gitea only uses slash `/`. --- modules/templates/mailer.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/templates/mailer.go b/modules/templates/mailer.go index a257e7c1d..355a9d6da 100644 --- a/modules/templates/mailer.go +++ b/modules/templates/mailer.go @@ -13,6 +13,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/watcher" ) @@ -65,6 +66,7 @@ func Mailer(ctx context.Context) (*texttmpl.Template, *template.Template) { } assetName := strings.TrimSuffix(name, ".tmpl") + assetName = util.PathJoinRelX(assetName) log.Trace("Adding mailer template for %s from %q", assetName, path) buildSubjectBodyTemplate(subjectTemplates, bodyTemplates,