From 604487920d1bde3707415dcfbc0bc8d5f16eac96 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 12 May 2019 09:20:53 +0100 Subject: [PATCH] fixes: requiring a trailing slash (#669) --- http/http.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/http/http.go b/http/http.go index a80a79f9..3cf67035 100644 --- a/http/http.go +++ b/http/http.go @@ -19,6 +19,11 @@ func NewHandler(storage *storage.Storage, server *settings.Server) (http.Handler r := mux.NewRouter() index, static := getStaticHandlers(storage, server) + // NOTE: This fixes the issue where it would redirect if people did not put a + // trailing slash in the end. I hate this decision since this allows some awful + // URLs https://www.gorillatoolkit.org/pkg/mux#Router.SkipClean + r = r.SkipClean(true) + monkey := func(fn handleFunc, prefix string) http.Handler { return handle(fn, prefix, storage, server) }