~emersion/public-inbox

kimchi: Include query parameters when using the 'redirect' directive v1 PROPOSED

Alex McGrath: 1
 Include query parameters when using the 'redirect' directive

 1 files changed, 10 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/36965/mbox | git am -3
Learn more about email & git

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

---
 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