Skip to content

Commit

Permalink
Fix mail template error (go-gitea#29410)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Feb 26, 2024
1 parent 4f70ebb commit eb2fc18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions modules/templates/mailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ func buildSubjectBodyTemplate(stpl *texttmpl.Template, btpl *template.Template,
}
if _, err := stpl.New(name).
Parse(string(subjectContent)); err != nil {
log.Warn("Failed to parse template [%s/subject]: %v", name, err)
log.Error("Failed to parse template [%s/subject]: %v", name, err)
if !setting.IsProd {
log.Fatal("Please fix the mail template error")
}
}
if _, err := btpl.New(name).
Parse(string(bodyContent)); err != nil {
log.Warn("Failed to parse template [%s/body]: %v", name, err)
log.Error("Failed to parse template [%s/body]: %v", name, err)
if !setting.IsProd {
log.Fatal("Please fix the mail template error")
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion templates/mail/notify/repo_transfer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>{{.Subject}}</title>
</head>

{{$url := HTMLFormat "<a href='%[1]s'>%[2]s</a>" .Link .Repo)}}
{{$url := HTMLFormat "<a href='%[1]s'>%[2]s</a>" .Link .Repo}}
<body>
<p>{{.Subject}}.
{{.locale.Tr "mail.repo.transfer.body" $url}}
Expand Down

0 comments on commit eb2fc18

Please sign in to comment.