aboutsummaryrefslogtreecommitdiff
path: root/http_handle_repo_contrib_index.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-19 21:24:47 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-19 21:24:47 +0800
commit114dd59d703d00efe86ad02eb956aa5343daa08e (patch)
tree937eb5579864e6da5a4210fdcf943a7fb15acf07 /http_handle_repo_contrib_index.go
parentssh/recv, hooks: Create MRs on push, reject pushes to others' MRs (diff)
downloadforge-114dd59d703d00efe86ad02eb956aa5343daa08e.tar.gz
forge-114dd59d703d00efe86ad02eb956aa5343daa08e.tar.zst
forge-114dd59d703d00efe86ad02eb956aa5343daa08e.zip
all: Use COALESCE to handle some nullable database fields
Diffstat (limited to '')
-rw-r--r--http_handle_repo_contrib_index.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/http_handle_repo_contrib_index.go b/http_handle_repo_contrib_index.go
index 94a24b8..e864dfa 100644
--- a/http_handle_repo_contrib_index.go
+++ b/http_handle_repo_contrib_index.go
@@ -11,7 +11,7 @@ type id_title_status_t struct {
}
func handle_repo_contrib_index(w http.ResponseWriter, r *http.Request, params map[string]any) {
- rows, err := database.Query(r.Context(), "SELECT id, title, status FROM merge_requests WHERE repo_id = $1", params["repo_id"])
+ rows, err := database.Query(r.Context(), "SELECT id, COALESCE(title, 'Untitled'), status FROM merge_requests WHERE repo_id = $1", params["repo_id"])
if err != nil {
http.Error(w, "Error querying merge requests: "+err.Error(), http.StatusInternalServerError)
return