diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-01 11:16:19 +0100 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-03-06 05:10:45 +0100 |
commit | 2892aaab0258a606719ad7f71a5087aba3549325 (patch) | |
tree | 6338d320723691118cd5005bf7b1e10234414c2b /templates/base | |
parent | Refactor some Str2html code (followup) (diff) | |
download | forgejo-2892aaab0258a606719ad7f71a5087aba3549325.tar.xz forgejo-2892aaab0258a606719ad7f71a5087aba3549325.zip |
Rename Str2html to SanitizeHTML and clarify its behavior (#29516)
Str2html was abused a lot. So use a proper name for it: SanitizeHTML
And add some tests to show its behavior.
(cherry picked from commit fb42972c057364a1dc99dfb528554e7a94415be7)
Conflicts:
docs/content/administration/mail-templates.en-us.md
docs/content/administration/mail-templates.zh-cn.md
prefer their version always
Diffstat (limited to 'templates/base')
-rw-r--r-- | templates/base/alert.tmpl | 8 | ||||
-rw-r--r-- | templates/base/alert_details.tmpl | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/templates/base/alert.tmpl b/templates/base/alert.tmpl index 160584f769..760d3bfa2c 100644 --- a/templates/base/alert.tmpl +++ b/templates/base/alert.tmpl @@ -1,20 +1,20 @@ {{if .Flash.ErrorMsg}} <div class="ui negative message flash-message flash-error"> - <p>{{.Flash.ErrorMsg | Str2html}}</p> + <p>{{.Flash.ErrorMsg | SanitizeHTML}}</p> </div> {{end}} {{if .Flash.SuccessMsg}} <div class="ui positive message flash-message flash-success"> - <p>{{.Flash.SuccessMsg | Str2html}}</p> + <p>{{.Flash.SuccessMsg | SanitizeHTML}}</p> </div> {{end}} {{if .Flash.InfoMsg}} <div class="ui info message flash-message flash-info"> - <p>{{.Flash.InfoMsg | Str2html}}</p> + <p>{{.Flash.InfoMsg | SanitizeHTML}}</p> </div> {{end}} {{if .Flash.WarningMsg}} <div class="ui warning message flash-message flash-warning"> - <p>{{.Flash.WarningMsg | Str2html}}</p> + <p>{{.Flash.WarningMsg | SanitizeHTML}}</p> </div> {{end}} diff --git a/templates/base/alert_details.tmpl b/templates/base/alert_details.tmpl index 1d7ec15dc0..6801c8240f 100644 --- a/templates/base/alert_details.tmpl +++ b/templates/base/alert_details.tmpl @@ -2,6 +2,6 @@ <details> <summary>{{.Summary}}</summary> <code> - {{.Details | Str2html}} + {{.Details | SanitizeHTML}} </code> </details> |