From 56220515fc882943e366fafbce4d5b2b3ccee702 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 23 Aug 2022 14:58:04 +0200 Subject: Enable contenthash in filename for dynamic assets (#20813) This should solve the main problem of dynamic assets getting stale after a version upgrade. Everything not affected will use query-string based cache busting, which includes files loaded via HTML or worker scripts. --- modules/templates/helper.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules/templates') diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 410857f37e..10b7022ea6 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -81,6 +81,9 @@ func NewFuncMap() []template.FuncMap { "AppDomain": func() string { return setting.Domain }, + "AssetVersion": func() string { + return setting.AssetVersion + }, "DisableGravatar": func() bool { return setting.DisableGravatar }, @@ -150,7 +153,6 @@ func NewFuncMap() []template.FuncMap { "DiffTypeToStr": DiffTypeToStr, "DiffLineTypeToStr": DiffLineTypeToStr, "ShortSha": base.ShortSha, - "MD5": base.EncodeMD5, "ActionContent2Commits": ActionContent2Commits, "PathEscape": url.PathEscape, "PathEscapeSegments": util.PathEscapeSegments, -- cgit v1.2.3