Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-12-01 14:26:10 +01:00

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 `/`.
This commit is contained in:
wxiaoguang 2023-04-13 00:16:40 +08:00 committed by GitHub
parent d562b419b6
commit 16d2cf05ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,