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_commit.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'http_handle_repo_commit.go') diff --git a/http_handle_repo_commit.go b/http_handle_repo_commit.go index 25f1331..ee21f16 100644 --- a/http_handle_repo_commit.go +++ b/http_handle_repo_commit.go @@ -21,7 +21,7 @@ func handle_repo_commit(w http.ResponseWriter, r *http.Request, params map[strin group_name, repo_name, commit_id_specified_string := params["group_name"].(string), params["repo_name"].(string), params["commit_id"].(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 @@ -29,13 +29,13 @@ func handle_repo_commit(w http.ResponseWriter, r *http.Request, params map[strin commit_id := plumbing.NewHash(commit_id_specified_string_without_suffix) commit_object, err := repo.CommitObject(commit_id) 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 } if commit_id_specified_string_without_suffix != commit_id_specified_string { patch, err := format_patch_from_commit(commit_object) if err != nil { - http.Error(w, "Error formatting patch:: "+err.Error(), http.StatusInternalServerError) + http.Error(w, "Error formatting patch: "+err.Error(), http.StatusInternalServerError) return } fmt.Fprintln(w, patch) @@ -53,7 +53,7 @@ func handle_repo_commit(w http.ResponseWriter, r *http.Request, params map[strin parent_commit_hash, patch, err := get_patch_from_commit(commit_object) if err != nil { - http.Error(w, "Error getting patch from commit:: "+err.Error(), http.StatusInternalServerError) + http.Error(w, "Error getting patch from commit: "+err.Error(), http.StatusInternalServerError) return } params["parent_commit_hash"] = parent_commit_hash.String() @@ -81,7 +81,7 @@ func handle_repo_commit(w http.ResponseWriter, r *http.Request, params map[strin err = templates.ExecuteTemplate(w, "repo_commit", 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