From d2cd1342bfa6ba5516590659048baae998eb5ed6 Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Tue, 19 Mar 2024 18:47:53 +0500 Subject: [PATCH] Deprecate usage of FileSize in templates --- modules/templates/helper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 18a2993fb8..c9799a38ec 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -63,7 +63,7 @@ func NewFuncMap() template.FuncMap { // ----------------------------------------------------------------- // time / number / format - "FileSize": base.FileSize, + "FileSize": FileSizePanic, "CountFmt": base.FormatNumberSI, "TimeSince": timeutil.TimeSince, "TimeSinceUnix": timeutil.TimeSinceUnix, @@ -249,3 +249,7 @@ func Eval(tokens ...any) (any, error) { n, err := eval.Expr(tokens...) return n.Value, err } + +func FileSizePanic(s int64) string { + panic("Usage of FileSize in templates is deprecated in Forgejo. Locale.TrSize should be used instead.") +}