From 370874cc4af7bb1b20a1a429de8a54b32fd91602 Mon Sep 17 00:00:00 2001 From: Changkun Ou Date: Fri, 30 Oct 2020 23:18:48 +0100 Subject: [PATCH] short: handle trailing slash --- short.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/short.go b/short.go index b418fa3..bd27e20 100644 --- a/short.go +++ b/short.go @@ -127,7 +127,7 @@ func (s *server) sHandler(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "/404.html", http.StatusTemporaryRedirect) } }() - alias := strings.TrimPrefix(r.URL.Path, conf.S.Prefix) + alias := strings.TrimSuffix(strings.TrimPrefix(r.URL.Path, conf.S.Prefix), "/") if alias == "" { err = s.stats(ctx, w) return