diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-10 09:51:31 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-10 09:51:31 +0300 |
| commit | af09a8ad94bfeddd1f7ccfad3aacab1332f915c9 (patch) | |
| tree | a6834bd05bad571e57b03dcdb0be119b109d628c /internal/api/handlers_admin.go | |
| parent | 820c1a4737949d39397394525665efd0c672bd51 (diff) | |
api: reject id==0 in handleDeleteUser to avoid 200 OK for invalid path
Diffstat (limited to 'internal/api/handlers_admin.go')
| -rw-r--r-- | internal/api/handlers_admin.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/api/handlers_admin.go b/internal/api/handlers_admin.go index 77e5b9f..6d10c67 100644 --- a/internal/api/handlers_admin.go +++ b/internal/api/handlers_admin.go @@ -78,6 +78,10 @@ func (s *Server) handleDeleteUser(w http.ResponseWriter, r *http.Request) { return } id := pathID(r, "id") + if id == 0 { + badRequest(w, "invalid user id") + return + } adminUser, _ := r.Context().Value(userCtxKey).(*model.User) if adminUser != nil && adminUser.ID == id { badRequest(w, "cannot delete self") |
