From 33b3b07b39bd4597c3f2886d6f36e89c7d331a1f Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 21 Jul 2021 12:13:18 +0100 Subject: [PATCH] Review comments @Kegsay --- clientapi/routing/createroom.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clientapi/routing/createroom.go b/clientapi/routing/createroom.go index 156abd521..4219bb37c 100644 --- a/clientapi/routing/createroom.go +++ b/clientapi/routing/createroom.go @@ -209,6 +209,7 @@ func createRoom( createContent := map[string]interface{}{} if len(r.CreationContent) > 0 { if err = json.Unmarshal(r.CreationContent, &createContent); err != nil { + util.GetLogger(req.Context()).WithError(err).Error("json.Unmarshal for creation_content failed") return util.JSONResponse{ Code: http.StatusBadRequest, JSON: jsonerror.BadJSON("invalid create content"), @@ -229,6 +230,7 @@ func createRoom( // Merge powerLevelContentOverride fields by unmarshalling it atop the defaults err = json.Unmarshal(r.PowerLevelContentOverride, &powerLevelContent) if err != nil { + util.GetLogger(req.Context()).WithError(err).Error("json.Unmarshal for power_level_content_override failed") return util.JSONResponse{ Code: http.StatusBadRequest, JSON: jsonerror.BadJSON("malformed power_level_content_override"), @@ -336,6 +338,11 @@ func createRoom( var initialStateEvents []fledglingEvent for i := range r.InitialState { + if r.InitialState[i].StateKey != "" { + initialStateEvents = append(initialStateEvents, r.InitialState[i]) + continue + } + switch r.InitialState[i].Type { case gomatrixserverlib.MRoomCreate: continue