forked from mirrors/pronouns.cc
fix(api): don't panic if PATCH /users/@me does not have "fields" set
This commit is contained in:
parent
59a1a3fb9b
commit
6cc4d4c41d
1 changed files with 14 additions and 12 deletions
|
@ -71,6 +71,7 @@ func (s *Server) patchUser(w http.ResponseWriter, r *http.Request) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.Fields) != nil {
|
||||||
// max 25 fields
|
// max 25 fields
|
||||||
if len(*req.Fields) > db.MaxFields {
|
if len(*req.Fields) > db.MaxFields {
|
||||||
return server.APIError{
|
return server.APIError{
|
||||||
|
@ -88,6 +89,7 @@ func (s *Server) patchUser(w http.ResponseWriter, r *http.Request) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// start transaction
|
// start transaction
|
||||||
tx, err := s.DB.Begin(ctx)
|
tx, err := s.DB.Begin(ctx)
|
||||||
|
|
Loading…
Reference in a new issue