mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-05 11:51:16 -06:00
Merge pull request #3376 from rhafer/graph-user-patch
graph: Allow PATCH on user without 'mail' in body
This commit is contained in:
6
changelog/unreleased/graph-patch-mail.md
Normal file
6
changelog/unreleased/graph-patch-mail.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Bugfix: Fix request validation on GraphAPI User updates
|
||||
|
||||
Fix PATCH on graph/v1.0/users when no 'mail' attribute
|
||||
is present in the request body
|
||||
|
||||
https://github.com/owncloud/ocis/issues/3167
|
||||
@@ -180,11 +180,12 @@ func (g Graph) PatchUser(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
mail := changes.GetMail()
|
||||
if !isValidEmail(mail) {
|
||||
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest,
|
||||
fmt.Sprintf("'%s' is not a valid email address", mail))
|
||||
return
|
||||
if mail, ok := changes.GetMailOk(); ok {
|
||||
if !isValidEmail(*mail) {
|
||||
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest,
|
||||
fmt.Sprintf("'%s' is not a valid email address", *mail))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
u, err := g.identityBackend.UpdateUser(r.Context(), nameOrID, *changes)
|
||||
|
||||
Reference in New Issue
Block a user