~emersion/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH kimchi] Include query parameters when using the 'redirect' directive

Details
Message ID
<20221120142834.31932-1-amk@amk.ie>
DKIM signature
missing
Download raw message
Patch: +10 -1
---
 directives.go | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/directives.go b/directives.go
index 9a57ff4..8891d9e 100644
--- a/directives.go
+++ b/directives.go
@@ -229,7 +229,16 @@ var backends = map[string]parseBackendFunc{
		if err := dir.ParseParams(&to); err != nil {
			return nil, err
		}
		return http.RedirectHandler(to, http.StatusFound), nil

		var redirector http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
			to := to
			if len(r.URL.RawQuery) > 0 {
				to += "?" + r.URL.RawQuery
			}
			http.Redirect(w, r, to, http.StatusFound)
		}

		return redirector, nil
	},
}

-- 
2.38.1
Reply to thread Export thread (mbox)