forked from gitea/gitea
* fix go1.15 lint error in modules/public/public.go * CI.restart()
This commit is contained in:
parent
8a51c48eb6
commit
2806a312e1
|
@ -6,6 +6,7 @@ package public
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
|
@ -159,7 +160,7 @@ func (opts *Options) handle(ctx *macaron.Context, log *log.Logger, opt *Options)
|
||||||
// Add an Expires header to the static content
|
// Add an Expires header to the static content
|
||||||
if opt.ExpiresAfter > 0 {
|
if opt.ExpiresAfter > 0 {
|
||||||
ctx.Resp.Header().Set("Expires", time.Now().Add(opt.ExpiresAfter).UTC().Format(http.TimeFormat))
|
ctx.Resp.Header().Set("Expires", time.Now().Add(opt.ExpiresAfter).UTC().Format(http.TimeFormat))
|
||||||
tag := GenerateETag(string(fi.Size()), fi.Name(), fi.ModTime().UTC().Format(http.TimeFormat))
|
tag := GenerateETag(fmt.Sprint(fi.Size()), fi.Name(), fi.ModTime().UTC().Format(http.TimeFormat))
|
||||||
ctx.Resp.Header().Set("ETag", tag)
|
ctx.Resp.Header().Set("ETag", tag)
|
||||||
if ctx.Req.Header.Get("If-None-Match") == tag {
|
if ctx.Req.Header.Get("If-None-Match") == tag {
|
||||||
ctx.Resp.WriteHeader(304)
|
ctx.Resp.WriteHeader(304)
|
||||||
|
|
Loading…
Reference in New Issue