aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--http_handle_login.go12
-rw-r--r--http_handle_repo_commit.go10
-rw-r--r--http_handle_repo_index.go12
-rw-r--r--http_handle_repo_log.go8
-rw-r--r--http_handle_repo_raw.go16
-rw-r--r--http_handle_repo_tree.go22
6 files changed, 40 insertions, 40 deletions
diff --git a/http_handle_login.go b/http_handle_login.go
index 70a8c8b..2d2dbf6 100644
--- a/http_handle_login.go
+++ b/http_handle_login.go
@@ -16,7 +16,7 @@ func handle_login(w http.ResponseWriter, r *http.Request, params map[string]any)
if r.Method != "POST" {
err := templates.ExecuteTemplate(w, "login", 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
}
@@ -32,17 +32,17 @@ func handle_login(w http.ResponseWriter, r *http.Request, params map[string]any)
params["login_error"] = "Unknown username"
err := templates.ExecuteTemplate(w, "login", 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
}
- http.Error(w, "Error querying user information:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error querying user information: "+err.Error(), http.StatusInternalServerError)
return
}
match, err := argon2id.ComparePasswordAndHash(password, password_hash)
if err != nil {
- http.Error(w, "Error comparing password and hash:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error comparing password and hash: "+err.Error(), http.StatusInternalServerError)
return
}
@@ -50,7 +50,7 @@ func handle_login(w http.ResponseWriter, r *http.Request, params map[string]any)
params["login_error"] = "Invalid password"
err := templates.ExecuteTemplate(w, "login", 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
}
return
@@ -75,7 +75,7 @@ func handle_login(w http.ResponseWriter, r *http.Request, params map[string]any)
_, err = database.Exec(r.Context(), "INSERT INTO sessions (user_id, session_id) VALUES ($1, $2)", user_id, cookie_value)
if err != nil {
- http.Error(w, "Error inserting session:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error inserting session: "+err.Error(), http.StatusInternalServerError)
return
}
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
}
}
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
}
}
diff --git a/http_handle_repo_log.go b/http_handle_repo_log.go
index bdc0d78..72943be 100644
--- a/http_handle_repo_log.go
+++ b/http_handle_repo_log.go
@@ -11,26 +11,26 @@ func handle_repo_log(w http.ResponseWriter, r *http.Request, params map[string]a
group_name, repo_name, ref_name := params["group_name"].(string), params["repo_name"].(string), params["ref"].(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
ref, err := repo.Reference(plumbing.NewBranchReferenceName(ref_name), true)
if err != nil {
- http.Error(w, "Error getting repo reference:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error getting repo reference: "+err.Error(), http.StatusInternalServerError)
return
}
ref_hash := ref.Hash()
commits, err := get_recent_commits(repo, ref_hash, -1)
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"] = commits
err = templates.ExecuteTemplate(w, "repo_log", 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
}
}
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
}
}
diff --git a/http_handle_repo_tree.go b/http_handle_repo_tree.go
index cd88a6f..69bc40f 100644
--- a/http_handle_repo_tree.go
+++ b/http_handle_repo_tree.go
@@ -22,31 +22,31 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request, params map[string]
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
}
}
params["ref_type"], params["ref"], params["path_spec"] = ref_type, ref_name, path_spec
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_tree(w http.ResponseWriter, r *http.Request, params map[string]
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_tree(w http.ResponseWriter, r *http.Request, params map[string]
}
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
}
lexer := chroma_lexers.Match(path_spec)
@@ -76,7 +76,7 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request, params map[string]
}
iterator, err := lexer.Tokenise(nil, file_contents)
if err != nil {
- http.Error(w, "Error tokenizing code:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error tokenizing code: "+err.Error(), http.StatusInternalServerError)
return
}
var formatted_unencapsulated bytes.Buffer
@@ -84,7 +84,7 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request, params map[string]
formatter := chroma_formatters_html.New(chroma_formatters_html.WithClasses(true), chroma_formatters_html.TabWidth(8))
err = formatter.Format(&formatted_unencapsulated, style, iterator)
if err != nil {
- http.Error(w, "Error formatting code:: "+err.Error(), http.StatusInternalServerError)
+ http.Error(w, "Error formatting code: "+err.Error(), http.StatusInternalServerError)
return
}
formatted_encapsulated := template.HTML(formatted_unencapsulated.Bytes())
@@ -92,7 +92,7 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request, params map[string]
err = templates.ExecuteTemplate(w, "repo_tree_file", 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
}
return
@@ -109,7 +109,7 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request, params map[string]
err = templates.ExecuteTemplate(w, "repo_tree_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
}
}