diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-14 11:29:49 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-14 11:31:32 +0800 |
commit | 3f44e5773e9edd3044cd5235a36a06d01de13e31 (patch) | |
tree | 26fdb7daa55e3b5c9e69aa57592eb7059d365810 /http_server.go | |
parent | http_handle_repo_*.go: Remove redundant return (diff) | |
download | forge-3f44e5773e9edd3044cd5235a36a06d01de13e31.tar.gz forge-3f44e5773e9edd3044cd5235a36a06d01de13e31.tar.zst forge-3f44e5773e9edd3044cd5235a36a06d01de13e31.zip |
repo_log: Use parameters for refspec
Diffstat (limited to '')
-rw-r--r-- | http_server.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/http_server.go b/http_server.go index fc92ef1..16c30d5 100644 --- a/http_server.go +++ b/http_server.go @@ -142,18 +142,14 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { params["rest"] = strings.Join(segments[separator_index+4:], "/") handle_repo_raw(w, r, params) case "log": - if non_empty_last_segments_len > separator_index+5 { + if non_empty_last_segments_len > separator_index+4 { http.Error(w, "Too many parameters", http.StatusBadRequest) return - } else if non_empty_last_segments_len < separator_index+5 { - http.Error(w, "Insufficient parameters", http.StatusBadRequest) - return } - if trailing_slash { - http.Redirect(w, r, strings.TrimSuffix(r.URL.Path, "/"), http.StatusSeeOther) + if !trailing_slash { + http.Redirect(w, r, r.URL.Path+"/", http.StatusSeeOther) return } - params["ref_name"] = segments[separator_index+4] handle_repo_log(w, r, params) case "commit": if trailing_slash { |