From a0ff9a73b55e413be49a545935f4572301889559 Mon Sep 17 00:00:00 2001 From: WeebDataHoarder <57538841+WeebDataHoarder@users.noreply.github.com> Date: Sun, 16 Jan 2022 20:07:21 +0100 Subject: [PATCH] Use full original path for handler --- OrbitalBeat.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OrbitalBeat.go b/OrbitalBeat.go index 18dcf76..fa790bb 100644 --- a/OrbitalBeat.go +++ b/OrbitalBeat.go @@ -147,7 +147,8 @@ func handleQueryRequest(ctx *fasthttp.RequestCtx, identifier cid.Cid, extraArgum //TODO: setting to hide 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) } @@ -594,6 +595,9 @@ func main() { Compress: false, CompressBrotli: false, CacheDuration: time.Minute * 15, + PathRewrite: func(ctx *fasthttp.RequestCtx) []byte { + return ctx.Request.URI().PathOriginal() + }, } fsHandler = fs.NewRequestHandler()