aboutsummaryrefslogtreecommitdiff
path: root/http_handle_repo_raw.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-13 19:05:22 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-13 19:05:22 +0800
commitd7889bf3eab55f56d2ca94c462ca130fde705871 (patch)
treeaeecbbc43bb8608ef2299fa167da4d00bf53f98d /http_handle_repo_raw.go
parentschema.sql: password TEXT should not be NOT NULL (diff)
downloadforge-d7889bf3eab55f56d2ca94c462ca130fde705871.tar.gz
forge-d7889bf3eab55f56d2ca94c462ca130fde705871.tar.zst
forge-d7889bf3eab55f56d2ca94c462ca130fde705871.zip
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.
Diffstat (limited to 'http_handle_repo_raw.go')
-rw-r--r--http_handle_repo_raw.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/http_handle_repo_raw.go b/http_handle_repo_raw.go
index ba67ac1..b134f8d 100644
--- a/http_handle_repo_raw.go
+++ b/http_handle_repo_raw.go
@@ -19,7 +19,7 @@ func handle_repo_raw(w http.ResponseWriter, r *http.Request, params map[string]a
if errors.Is(err, err_no_ref_spec) {
ref_type = "head"
} else {
- http.Error(w, "Error querying ref type:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error querying ref type: "+err.Error(), http.StatusInternalServerError)
return
}
}
@@ -28,25 +28,25 @@ func handle_repo_raw(w http.ResponseWriter, r *http.Request, params map[string]a
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
ref_hash, err := get_ref_hash_from_type_and_name(repo, ref_type, ref_name)
if err != nil {
- http.Error(w, "Error getting ref hash:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error getting ref hash: "+err.Error(), http.StatusInternalServerError)
return
}
commit_object, err := repo.CommitObject(ref_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
}
@@ -58,7 +58,7 @@ func handle_repo_raw(w http.ResponseWriter, r *http.Request, params map[string]a
if err != nil {
file, err := tree.File(path_spec)
if err != nil {
- http.Error(w, "Error retrieving path:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error retrieving path: "+err.Error(), http.StatusInternalServerError)
return
}
if len(raw_path_spec) != 0 && raw_path_spec[len(raw_path_spec)-1] == '/' {
@@ -67,7 +67,7 @@ func handle_repo_raw(w http.ResponseWriter, r *http.Request, params map[string]a
}
file_contents, err := file.Contents()
if err != nil {
- http.Error(w, "Error reading file:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error reading file: "+err.Error(), http.StatusInternalServerError)
return
}
fmt.Fprintln(w, file_contents)
@@ -84,7 +84,7 @@ func handle_repo_raw(w http.ResponseWriter, r *http.Request, params map[string]a
err = templates.ExecuteTemplate(w, "repo_raw_dir", 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
}
}