From b4ed1fc1a3096a6148565dd1c3f47632dc42571d Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 31 Mar 2022 22:23:51 -0400 Subject: [PATCH] Check redirect path and add trailing slash if necessary --- http.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/http.go b/http.go index 3cfbd37..6dcc8d4 100644 --- a/http.go +++ b/http.go @@ -7,6 +7,7 @@ import ( "net/http" "net/url" "path" + "strings" ) func statusHandler(w http.ResponseWriter, r *http.Request) { @@ -82,6 +83,10 @@ func redirectHandler(w http.ResponseWriter, r *http.Request) { } } + if strings.HasSuffix(r.URL.Path, "/") && !strings.HasSuffix(redirectPath, "/") { + redirectPath += "/" + } + u := &url.URL{ Scheme: scheme, Host: server.Host,