1
0
Fork 0
forked from forgejo/forgejo

Don't store assets modified time into generated files (#18193)

This commit is contained in:
Lunny Xiao 2022-01-07 10:33:17 +08:00 committed by GitHub
parent 21ed4fd8da
commit a1c12fb0b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 110 additions and 22 deletions

View file

@ -15,9 +15,11 @@ import (
"path/filepath"
"strings"
texttmpl "text/template"
"time"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
)
@ -26,6 +28,11 @@ var (
bodyTemplates = template.New("")
)
// GlobalModTime provide a gloabl mod time for embedded asset files
func GlobalModTime(filename string) time.Time {
return timeutil.GetExecutableModTime()
}
// GetAsset get a special asset, only for chi
func GetAsset(name string) ([]byte, error) {
bs, err := os.ReadFile(filepath.Join(setting.CustomPath, name))