Skip to content

Commit

Permalink
Fix custom mailer template on Windows (go-gitea#24081)
Browse files Browse the repository at this point in the history
Fix go-gitea#24075
Fix go-gitea#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 `/`.
  • Loading branch information
wxiaoguang authored Apr 12, 2023
1 parent d562b41 commit 16d2cf0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/templates/mailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 16d2cf0

Please sign in to comment.