Calculate filename hash only once (#19654)

* Calculate hash only once.

* remove unused Sha1 template helper function, use ctx.Data["FileNameHash"]

* fix unit tests
This commit is contained in:
KN4CK3R 2022-05-09 00:29:50 +02:00 committed by GitHub
parent 9efa47131f
commit a9ca4b4100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 29 deletions

View file

@ -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)