Use full original path for handler

This commit is contained in:
DataHoarder 2022-01-16 20:07:21 +01:00
parent e4af79d85f
commit a0ff9a73b5

View file

@ -147,7 +147,8 @@ func handleQueryRequest(ctx *fasthttp.RequestCtx, identifier cid.Cid, extraArgum
//TODO: setting to hide filename //TODO: setting to hide filename
ctx.Response.Header.Set("Content-Disposition", fmt.Sprintf("inline; filename*=utf-8''%s", url.PathEscape(filename))) ctx.Response.Header.Set("Content-Disposition", fmt.Sprintf("inline; filename*=utf-8''%s", url.PathEscape(filename)))
ctx.Request.SetRequestURI(cacheEntry.Entry.Path) ctx.Request.URI().Reset()
ctx.Request.URI().SetPath(cacheEntry.Entry.Path)
fsHandler(ctx) fsHandler(ctx)
} }
@ -594,6 +595,9 @@ func main() {
Compress: false, Compress: false,
CompressBrotli: false, CompressBrotli: false,
CacheDuration: time.Minute * 15, CacheDuration: time.Minute * 15,
PathRewrite: func(ctx *fasthttp.RequestCtx) []byte {
return ctx.Request.URI().PathOriginal()
},
} }
fsHandler = fs.NewRequestHandler() fsHandler = fs.NewRequestHandler()