aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-05-09 00:29:50 +0200
committerGitHub <noreply@github.com>2022-05-09 00:29:50 +0200
commita9ca4b410080814051952f71a8339ea81e0de8bf (patch)
tree7201cc3caa17b361f5555298e52f31b78f756564 /routers/web
parent9efa47131f3fa576bd0ef73fa4c5b96c95d89906 (diff)
downloadgitea-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 'routers/web')
-rw-r--r--routers/web/repo/compare.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go
index d483227ebf..31914c43ab 100644
--- a/routers/web/repo/compare.go
+++ b/routers/web/repo/compare.go
@@ -874,7 +874,7 @@ func ExcerptBlob(ctx *context.Context) {
}
}
ctx.Data["section"] = section
- ctx.Data["fileName"] = filePath
+ ctx.Data["FileNameHash"] = base.EncodeSha1(filePath)
ctx.Data["AfterCommitID"] = commitID
ctx.Data["Anchor"] = anchor
ctx.HTML(http.StatusOK, tplBlobExcerpt)