diff --git a/services/graph/pkg/service/v0/groups.go b/services/graph/pkg/service/v0/groups.go index 895d21ab9d..cf465b5a0a 100644 --- a/services/graph/pkg/service/v0/groups.go +++ b/services/graph/pkg/service/v0/groups.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "sort" "strings" @@ -130,6 +131,13 @@ func (g Graph) PatchGroup(w http.ResponseWriter, r *http.Request) { return } + if reflect.ValueOf(*changes).IsZero() { + logger.Debug().Interface("body", r.Body).Msg("ignoring empyt request body") + render.Status(r, http.StatusNoContent) + render.NoContent(w, r) + return + } + if changes.HasDisplayName() { groupName := changes.GetDisplayName() err = g.identityBackend.UpdateGroupName(r.Context(), groupID, groupName) diff --git a/services/graph/pkg/service/v0/users.go b/services/graph/pkg/service/v0/users.go index 4e86377c82..5846247cf9 100644 --- a/services/graph/pkg/service/v0/users.go +++ b/services/graph/pkg/service/v0/users.go @@ -6,6 +6,7 @@ import ( "fmt" "net/http" "net/url" + "reflect" "regexp" "sort" "strings" @@ -646,6 +647,13 @@ func (g Graph) PatchUser(w http.ResponseWriter, r *http.Request) { return } + if reflect.ValueOf(*changes).IsZero() { + logger.Debug().Interface("body", r.Body).Msg("ignoring empyt request body") + render.Status(r, http.StatusNoContent) + render.NoContent(w, r) + return + } + var features []events.UserFeature if mail, ok := changes.GetMailOk(); ok { if !isValidEmail(*mail) {