From beba323119f42177e5298a11676a941ac9b482ad Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 19 Feb 2025 00:11:34 +0800 Subject: http: Consistently use redirect_with{out,}_slash, never r.URL.Path --- http_server.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'http_server.go') diff --git a/http_server.go b/http_server.go index 0cc6a8b..e5cb6ce 100644 --- a/http_server.go +++ b/http_server.go @@ -22,10 +22,8 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } non_empty_last_segments_len := len(segments) - trailing_slash := false if segments[len(segments)-1] == "" { non_empty_last_segments_len-- - trailing_slash = true } if segments[0] == ":" { @@ -186,9 +184,7 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { } handle_repo_log(w, r, params) case "commit": - if trailing_slash { - http.Redirect(w, r, strings.TrimSuffix(r.URL.Path, "/"), http.StatusSeeOther) - // TODO + if redirect_without_slash(w, r) { return } params["commit_id"] = segments[separator_index+4] -- cgit v1.2.3