mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 16:32:31 +01:00
fix (cloudflare): cloudflare cache issue
This commit is contained in:
parent
1b47b613b6
commit
dba8bc000a
1 changed files with 5 additions and 2 deletions
|
|
@ -409,6 +409,11 @@ func FileAccess(ctx *App, res http.ResponseWriter, req *http.Request) {
|
|||
var chunkedUploadCache AppCache
|
||||
|
||||
func FileSave(ctx *App, res http.ResponseWriter, req *http.Request) {
|
||||
h := res.Header()
|
||||
h.Set("Cache-Control", "no-store")
|
||||
h.Set("Pragma", "no-cache")
|
||||
h.Set("Connection", "Close")
|
||||
|
||||
path, err := PathBuilder(ctx, req.URL.Query().Get("path"))
|
||||
if err != nil {
|
||||
Log.Debug("save::path '%s'", err.Error())
|
||||
|
|
@ -465,7 +470,6 @@ func FileSave(ctx *App, res http.ResponseWriter, req *http.Request) {
|
|||
|
||||
// - case2: chunked upload which implements the TUS protocol:
|
||||
// https://www.ietf.org/archive/id/draft-tus-httpbis-resumable-uploads-protocol-00.html
|
||||
h := res.Header()
|
||||
ctx.Session["path"] = path
|
||||
if proto == "tus" && req.Method == http.MethodPost {
|
||||
if c := chunkedUploadCache.Get(ctx.Session); c != nil {
|
||||
|
|
@ -496,7 +500,6 @@ func FileSave(ctx *App, res http.ResponseWriter, req *http.Request) {
|
|||
return
|
||||
}
|
||||
if proto == "tus" && req.Method == http.MethodPatch {
|
||||
h.Set("Connection", "Close")
|
||||
requestOffset, err := strconv.ParseUint(req.Header.Get("Upload-Offset"), 10, 0)
|
||||
if err != nil {
|
||||
SendErrorResult(res, ErrNotValid)
|
||||
|
|
|
|||
Loading…
Reference in a new issue