diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-05-20 23:12:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-20 15:12:50 +0000 |
commit | fb1ad920b769799aa1287441289d15477d9878c5 (patch) | |
tree | 45734a3e7c7c5f15e9c62e06d134e7dee0262c4a /routers | |
parent | f1d9f18d96050d89a4085c961f572f07b1e653d1 (diff) | |
download | gitea-fb1ad920b769799aa1287441289d15477d9878c5.tar.gz gitea-fb1ad920b769799aa1287441289d15477d9878c5.zip |
Refactor sha1 and time-limited code (#31023)
Remove "EncodeSha1", it shouldn't be used as a general purpose hasher
(just like we have removed "EncodeMD5" in #28622)
Rewrite the "time-limited code" related code and write better tests, the
old code doesn't seem quite right.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/compare.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index 8c0fee71a0..818dc4d50f 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -931,7 +931,7 @@ func ExcerptBlob(ctx *context.Context) { } } ctx.Data["section"] = section - ctx.Data["FileNameHash"] = base.EncodeSha1(filePath) + ctx.Data["FileNameHash"] = git.HashFilePathForWebUI(filePath) ctx.Data["AfterCommitID"] = commitID ctx.Data["Anchor"] = anchor ctx.HTML(http.StatusOK, tplBlobExcerpt) |