diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-13 15:16:11 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-13 15:16:11 +0800 |
commit | 1364d688e454454258c6c97b1dc844cc94a67a9e (patch) | |
tree | f95b9370cff76eeba71b86dbcd7333586ba1f7a9 /http_handle_repo_index.go | |
parent | {http,ssh}_server.go: Add debug logs for incoming requests (diff) | |
download | forge-1364d688e454454258c6c97b1dc844cc94a67a9e.tar.gz forge-1364d688e454454258c6c97b1dc844cc94a67a9e.tar.zst forge-1364d688e454454258c6c97b1dc844cc94a67a9e.zip |
ssh_url_generation.go, etc.: Add config ssh.root and use it
Detecting it based on HTTP host name is definitely unreliable.
Just add a configuration option and it should work.
Diffstat (limited to 'http_handle_repo_index.go')
-rw-r--r-- | http_handle_repo_index.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go index 8a6f7b8..25bc107 100644 --- a/http_handle_repo_index.go +++ b/http_handle_repo_index.go @@ -2,7 +2,6 @@ package main import ( "net/http" - "net/url" ) func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string]any) { @@ -40,7 +39,7 @@ func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string params["readme_filename"], params["readme"] = render_readme_at_tree(tree) params["files"] = build_display_git_tree(tree) - params["clone_url"] = "ssh://" + r.Host + "/" + url.PathEscape(group_name) + "/:/repos/" + url.PathEscape(repo_name) + params["clone_url"] = generate_ssh_remote_url(group_name, repo_name) err = templates.ExecuteTemplate(w, "repo_index", params) if err != nil { |