diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-19 21:24:47 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-19 21:24:47 +0800 |
commit | 114dd59d703d00efe86ad02eb956aa5343daa08e (patch) | |
tree | 937eb5579864e6da5a4210fdcf943a7fb15acf07 /http_handle_repo_contrib_one.go | |
parent | ssh/recv, hooks: Create MRs on push, reject pushes to others' MRs (diff) | |
download | forge-114dd59d703d00efe86ad02eb956aa5343daa08e.tar.gz forge-114dd59d703d00efe86ad02eb956aa5343daa08e.tar.zst forge-114dd59d703d00efe86ad02eb956aa5343daa08e.zip |
all: Use COALESCE to handle some nullable database fields
Diffstat (limited to 'http_handle_repo_contrib_one.go')
-rw-r--r-- | http_handle_repo_contrib_one.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/http_handle_repo_contrib_one.go b/http_handle_repo_contrib_one.go index 6841f2b..0691050 100644 --- a/http_handle_repo_contrib_one.go +++ b/http_handle_repo_contrib_one.go @@ -16,7 +16,7 @@ func handle_repo_contrib_one(w http.ResponseWriter, r *http.Request, params map[ } var title, status, source_ref, destination_branch string - err = database.QueryRow(r.Context(), "SELECT title, status, source_ref, destination_branch FROM merge_requests WHERE id = $1", mr_id).Scan(&title, &status, &source_ref, &destination_branch) + err = database.QueryRow(r.Context(), "SELECT COALESCE(title, ''), status, source_ref, COALESCE(destination_branch, '') FROM merge_requests WHERE id = $1", mr_id).Scan(&title, &status, &source_ref, &destination_branch) if err != nil { http.Error(w, "Error querying merge request: "+err.Error(), http.StatusInternalServerError) return |