From d7889bf3eab55f56d2ca94c462ca130fde705871 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Feb 2025 19:05:22 +0800 Subject: http_handle_*.go: Fix http.Error calls Previously when I was converting the fmt.Fprintln calls into http.Error, there was a mistake in my sed command which caused some of the messages to have double colons. This should fix them. --- http_handle_repo_index.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'http_handle_repo_index.go') diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go index 25bc107..c9c4949 100644 --- a/http_handle_repo_index.go +++ b/http_handle_repo_index.go @@ -8,31 +8,31 @@ func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string group_name, repo_name := params["group_name"].(string), params["repo_name"].(string) repo, description, err := open_git_repo(r.Context(), group_name, repo_name) if err != nil { - http.Error(w, "Error opening repo:: "+err.Error(), http.StatusInternalServerError) + http.Error(w, "Error opening repo: "+err.Error(), http.StatusInternalServerError) return } params["repo_description"] = description head, err := repo.Head() if err != nil { - http.Error(w, "Error getting repo HEAD:: "+err.Error(), http.StatusInternalServerError) + http.Error(w, "Error getting repo HEAD: "+err.Error(), http.StatusInternalServerError) return } params["ref"] = head.Name().Short() head_hash := head.Hash() recent_commits, err := get_recent_commits(repo, head_hash, 3) if err != nil { - http.Error(w, "Error getting recent commits:: "+err.Error(), http.StatusInternalServerError) + http.Error(w, "Error getting recent commits: "+err.Error(), http.StatusInternalServerError) return } params["commits"] = recent_commits commit_object, err := repo.CommitObject(head_hash) if err != nil { - http.Error(w, "Error getting commit object:: "+err.Error(), http.StatusInternalServerError) + http.Error(w, "Error getting commit object: "+err.Error(), http.StatusInternalServerError) return } tree, err := commit_object.Tree() if err != nil { - http.Error(w, "Error getting file tree:: "+err.Error(), http.StatusInternalServerError) + http.Error(w, "Error getting file tree: "+err.Error(), http.StatusInternalServerError) return } @@ -43,7 +43,7 @@ func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string err = templates.ExecuteTemplate(w, "repo_index", params) if err != nil { - http.Error(w, "Error rendering template:: "+err.Error(), http.StatusInternalServerError) + http.Error(w, "Error rendering template: "+err.Error(), http.StatusInternalServerError) return } } -- cgit v1.2.3