diff options
author | zeripath <art27@cantab.net> | 2022-05-09 16:54:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-09 17:54:51 +0200 |
commit | 9f5ddca57c38f566fb18c9add339fc9f5aeb25de (patch) | |
tree | e9cba2540901589f98410b7d3ad23078a7dff11b /routers/web/repo/wiki.go | |
parent | e435283c0ffe437f35898f92dc5572c8df83163e (diff) | |
download | gitea-9f5ddca57c38f566fb18c9add339fc9f5aeb25de.tar.gz gitea-9f5ddca57c38f566fb18c9add339fc9f5aeb25de.zip |
Set the LastModified header for raw files (#18356)
Although the use of LastModified dates for caching of git objects should be
discouraged (as it is not native to git - and there are a LOT of ways this
could be incorrect) - LastModified dates can be a helpful somewhat more human
way of caching for simple cases.
This PR adds this header and handles the If-Modified-Since header to the /raw/
routes.
Fix #18354
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers/web/repo/wiki.go')
-rw-r--r-- | routers/web/repo/wiki.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/web/repo/wiki.go b/routers/web/repo/wiki.go index 8bdb6fbc03..77f60a1dfa 100644 --- a/routers/web/repo/wiki.go +++ b/routers/web/repo/wiki.go @@ -13,6 +13,7 @@ import ( "net/url" "path/filepath" "strings" + "time" "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/unit" @@ -627,7 +628,7 @@ func WikiRaw(ctx *context.Context) { } if entry != nil { - if err = common.ServeBlob(ctx, entry.Blob()); err != nil { + if err = common.ServeBlob(ctx, entry.Blob(), time.Time{}); err != nil { ctx.ServerError("ServeBlob", err) } return |