diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-12 20:06:03 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-12 20:06:03 +0800 |
commit | 04d1ed40ca996a61490c2656654fe8e729711bdd (patch) | |
tree | 0c6ce9d1c3bc058fd34bb21f6cfdd6c28acc4789 | |
parent | repo_info: Warning to http cloners (diff) | |
download | forge-04d1ed40ca996a61490c2656654fe8e729711bdd.tar.gz forge-04d1ed40ca996a61490c2656654fe8e729711bdd.tar.zst forge-04d1ed40ca996a61490c2656654fe8e729711bdd.zip |
router_{http,ssh}.go, url_misc.go: Fix escaping
Diffstat (limited to '')
-rw-r--r-- | router_http.go | 2 | ||||
-rw-r--r-- | router_ssh.go | 2 | ||||
-rw-r--r-- | url_misc.go | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/router_http.go b/router_http.go index 754cf10..9b42e9b 100644 --- a/router_http.go +++ b/router_http.go @@ -83,6 +83,8 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { } repo_feature := segments[separator_index+3] switch repo_feature { + case "info": + handle_repo_info(w, r, params) case "tree": params["rest"] = strings.Join(segments[separator_index+4:], "/") handle_repo_tree(w, r, params) diff --git a/router_ssh.go b/router_ssh.go index 6b5280b..8eaaebd 100644 --- a/router_ssh.go +++ b/router_ssh.go @@ -14,7 +14,7 @@ func get_repo_path_from_ssh_path(ctx context.Context, ssh_path string) (repo_pat for i, segment := range segments { var err error - segments[i], err = url.QueryUnescape(segment) + segments[i], err = url.PathUnescape(segment) if err != nil { return "", err } diff --git a/url_misc.go b/url_misc.go index 7dc0ad5..86a3c6e 100644 --- a/url_misc.go +++ b/url_misc.go @@ -50,7 +50,7 @@ func parse_request_uri(request_uri string) (segments []string, params url.Values segments = strings.Split(strings.TrimPrefix(path, "/"), "/") for i, segment := range segments { - segments[i], err = url.QueryUnescape(segment) + segments[i], err = url.PathUnescape(segment) if err != nil { return nil, nil, misc.Wrap_one_error(err_bad_request, err) } |