diff options
author | Runxi Yu <me@runxiyu.org> | 2025-03-06 22:01:08 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-03-06 22:01:31 +0800 |
commit | fa62d8eae273d89937d65d6a294f028e1ce22d88 (patch) | |
tree | 226d5fab65927ef977b664a35e6a2b2f30169440 /url.go | |
parent | group: Add description field to the create repo form (diff) | |
download | forge-fa62d8eae273d89937d65d6a294f028e1ce22d88.tar.gz forge-fa62d8eae273d89937d65d6a294f028e1ce22d88.tar.zst forge-fa62d8eae273d89937d65d6a294f028e1ce22d88.zip |
group/index: Allow repo creation via web
Diffstat (limited to 'url.go')
-rw-r--r-- | url.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -99,6 +99,21 @@ func redirect_without_slash(w http.ResponseWriter, r *http.Request) bool { return false } +func redirect_unconditionally(w http.ResponseWriter, r *http.Request) { + request_uri := r.RequestURI + + path_end := strings.IndexAny(request_uri, "?#") + var path, rest string + if path_end == -1 { + path = request_uri + } else { + path = request_uri[:path_end] + rest = request_uri[path_end:] + } + + http.Redirect(w, r, path+rest, http.StatusSeeOther) +} + func path_escape_cat_segments(segments []string) string { for i, segment := range segments { segments[i] = url.PathEscape(segment) |