From ac8df1ce8c48547a9c73dd51461f7212585962c2 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 12 Feb 2025 22:59:56 +0800 Subject: router_http: Ensure module index has / --- router_http.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/router_http.go b/router_http.go index 9b42e9b..fbf729b 100644 --- a/router_http.go +++ b/router_http.go @@ -57,6 +57,10 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { case non_empty_last_segments_len == separator_index+1: http.Error(w, "Group root hasn't been implemented yet", http.StatusNotImplemented) case non_empty_last_segments_len == separator_index+2: + if !dir_mode { + http.Redirect(w, r, r.URL.Path+"/", http.StatusSeeOther) + return + } module_type := segments[separator_index+1] params["group_name"] = segments[0] switch module_type { -- cgit v1.2.3