diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-05-09 00:29:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-09 00:29:50 +0200 |
commit | a9ca4b410080814051952f71a8339ea81e0de8bf (patch) | |
tree | 7201cc3caa17b361f5555298e52f31b78f756564 /modules/templates | |
parent | 9efa47131f3fa576bd0ef73fa4c5b96c95d89906 (diff) | |
download | gitea-a9ca4b410080814051952f71a8339ea81e0de8bf.tar.gz gitea-a9ca4b410080814051952f71a8339ea81e0de8bf.zip |
Calculate filename hash only once (#19654)
* Calculate hash only once.
* remove unused Sha1 template helper function, use ctx.Data["FileNameHash"]
* fix unit tests
Diffstat (limited to 'modules/templates')
-rw-r--r-- | modules/templates/helper.go | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 1201710b92..682459d94a 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -146,7 +146,6 @@ func NewFuncMap() []template.FuncMap { "EllipsisString": base.EllipsisString, "DiffTypeToStr": DiffTypeToStr, "DiffLineTypeToStr": DiffLineTypeToStr, - "Sha1": Sha1, "ShortSha": base.ShortSha, "MD5": base.EncodeMD5, "ActionContent2Commits": ActionContent2Commits, @@ -649,11 +648,6 @@ func DotEscape(raw string) string { return strings.ReplaceAll(raw, ".", "\u200d.\u200d") } -// Sha1 returns sha1 sum of string -func Sha1(str string) string { - return base.EncodeSha1(str) -} - // RenderCommitMessage renders commit message with XSS-safe and special links. func RenderCommitMessage(ctx context.Context, msg, urlPrefix string, metas map[string]string) template.HTML { return RenderCommitMessageLink(ctx, msg, urlPrefix, "", metas) |