From 71ab9b7f14118f02dd18cd733bd4e0ad19ece590 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 5 Apr 2025 20:21:32 +0800 Subject: config shall no longer be a global variable --- http_handle_repo_index.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'http_handle_repo_index.go') diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go index ef1b76e..c253fa9 100644 --- a/http_handle_repo_index.go +++ b/http_handle_repo_index.go @@ -20,18 +20,18 @@ type commitDisplay struct { } // httpHandleRepoIndex provides the front page of a repo using git2d. -func httpHandleRepoIndex(w http.ResponseWriter, req *http.Request, params map[string]any) { +func (s *server) httpHandleRepoIndex(w http.ResponseWriter, req *http.Request, params map[string]any) { repoName := params["repo_name"].(string) groupPath := params["group_path"].([]string) - _, repoPath, _, _, _, _, _ := getRepoInfo(req.Context(), groupPath, repoName, "") // TODO: Don't use getRepoInfo + _, repoPath, _, _, _, _, _ := s.getRepoInfo(req.Context(), groupPath, repoName, "") // TODO: Don't use getRepoInfo var notes []string if strings.Contains(repoName, "\n") || sliceContainsNewlines(groupPath) { notes = append(notes, "Path contains newlines; HTTP Git access impossible") } - client, err := git2c.NewClient(config.Git.Socket) + client, err := git2c.NewClient(s.config.Git.Socket) if err != nil { errorPage500(w, params, err.Error()) return -- cgit v1.2.3