diff options
author | Morgan Bazalgette <git@howl.moe> | 2018-02-03 23:37:05 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-02-04 00:37:05 +0200 |
commit | 17655cdf1b409521262d5d54eb19884d307c47ce (patch) | |
tree | b06d15367afc6bd4f915c0e8b9272241bb3f4a3c /modules/public/static.go | |
parent | 77f8bad2fb7a6a4ab57b398cb89e6889f76ffe8a (diff) | |
download | gitea-17655cdf1b409521262d5d54eb19884d307c47ce.tar.gz gitea-17655cdf1b409521262d5d54eb19884d307c47ce.zip |
Enable caching on assets and avatars (#3376)
* Enable caching on assets and avatars
Fixes #3323
* Only set avatar in user BeforeUpdate when there is no avatar set
* add error checking after stat
* gofmt
* Change cache time for avatars to an hour
Diffstat (limited to 'modules/public/static.go')
-rw-r--r-- | modules/public/static.go | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/modules/public/static.go b/modules/public/static.go index f68400d329..10e32dbd10 100644 --- a/modules/public/static.go +++ b/modules/public/static.go @@ -13,17 +13,14 @@ import ( // Static implements the macaron static handler for serving assets. func Static(opts *Options) macaron.Handler { - return macaron.Static( - opts.Directory, - macaron.StaticOptions{ - SkipLogging: opts.SkipLogging, - FileSystem: bindata.Static(bindata.Options{ - Asset: Asset, - AssetDir: AssetDir, - AssetInfo: AssetInfo, - AssetNames: AssetNames, - Prefix: "", - }), - }, - ) + opts.FileSystem = bindata.Static(bindata.Options{ + Asset: Asset, + AssetDir: AssetDir, + AssetInfo: AssetInfo, + AssetNames: AssetNames, + Prefix: "", + }) + // we don't need to pass the directory, because the directory var is only + // used when in the options there is no FileSystem. + return opts.staticHandler("") } |