aboutsummaryrefslogtreecommitdiff
path: root/http_auth.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_auth.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_auth.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/http_auth.go b/http_auth.go
index 370e38b..eb6e604 100644
--- a/http_auth.go
+++ b/http_auth.go
@@ -10,7 +10,7 @@ func get_user_info_from_request(r *http.Request) (id int, username string, err e
return
}
- err = database.QueryRow(r.Context(), "SELECT user_id, username FROM users u JOIN sessions s ON u.id = s.user_id WHERE s.session_id = $1;", session_cookie.Value).Scan(&id, &username)
+ err = database.QueryRow(r.Context(), "SELECT user_id, COALESCE(username, '') FROM users u JOIN sessions s ON u.id = s.user_id WHERE s.session_id = $1;", session_cookie.Value).Scan(&id, &username)
return
}