diff options
Diffstat (limited to '')
-rw-r--r-- | router.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -85,9 +85,21 @@ 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 { + fmt.Fprintln(w, "Too many parameters") + return + } + if dir_mode { + http.Redirect(w, r, strings.TrimSuffix(r.URL.Path, "/"), http.StatusSeeOther) + return + } params["ref"] = segments[separator_index+4] handle_repo_log(w, r, params) case "commit": + if dir_mode { + http.Redirect(w, r, strings.TrimSuffix(r.URL.Path, "/"), http.StatusSeeOther) + return + } params["commit_id"] = segments[separator_index+4] handle_repo_commit(w, r, params) } |