aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-03-01 18:16:19 +0800
committerGitHub <noreply@github.com>2024-03-01 10:16:19 +0000
commitfb42972c057364a1dc99dfb528554e7a94415be7 (patch)
tree162d9e043c62df788f438ae2bb65983e301f8517 /templates/repo
parentcb52b17f92e2d2293f7c003649743464492bca48 (diff)
downloadgitea-fb42972c057364a1dc99dfb528554e7a94415be7.tar.gz
gitea-fb42972c057364a1dc99dfb528554e7a94415be7.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.
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/commit_page.tmpl2
-rw-r--r--templates/repo/issue/view_content/comments.tmpl2
-rw-r--r--templates/repo/settings/webhook/base_list.tmpl2
3 files changed, 3 insertions, 3 deletions
diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl
index 115ee92955..7892a57163 100644
--- a/templates/repo/commit_page.tmpl
+++ b/templates/repo/commit_page.tmpl
@@ -276,7 +276,7 @@
<span class="text grey" id="note-authored-time">{{TimeSince .NoteCommit.Author.When ctx.Locale}}</span>
</div>
<div class="ui bottom attached info segment git-notes">
- <pre class="commit-body">{{.NoteRendered | Str2html}}</pre>
+ <pre class="commit-body">{{.NoteRendered | SanitizeHTML}}</pre>
</div>
{{end}}
{{template "repo/diff/box" .}}
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index 36ef5751ae..66ecc544d2 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -162,7 +162,7 @@
</span>
<div class="detail">
{{svg "octicon-git-commit"}}
- <span class="text grey muted-links">{{.Content | Str2html}}</span>
+ <span class="text grey muted-links">{{.Content | SanitizeHTML}}</span>
</div>
</div>
{{else if eq .Type 7}}
diff --git a/templates/repo/settings/webhook/base_list.tmpl b/templates/repo/settings/webhook/base_list.tmpl
index 5a3fc0e7b8..00f9a48ba7 100644
--- a/templates/repo/settings/webhook/base_list.tmpl
+++ b/templates/repo/settings/webhook/base_list.tmpl
@@ -10,7 +10,7 @@
<div class="ui attached segment">
<div class="ui list">
<div class="item">
- {{.Description | Str2html}}
+ {{.Description | SanitizeHTML}}
</div>
{{range .Webhooks}}
<div class="item truncated-item-container">