Skip to content
Snippets Groups Projects
Unverified Commit 2cb85bdf authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

Raise an error if an unknown preset is used to create a room. (#10738)

Raises a 400 error instead of a 500 if an unknown preset is passed
from a client to create a room.
parent ecbfa4fe
No related branches found
No related tags found
No related merge requests found
Additional error checking for the `preset` field when creating a room.
...@@ -909,7 +909,12 @@ class RoomCreationHandler(BaseHandler): ...@@ -909,7 +909,12 @@ class RoomCreationHandler(BaseHandler):
) )
return last_stream_id return last_stream_id
config = self._presets_dict[preset_config] try:
config = self._presets_dict[preset_config]
except KeyError:
raise SynapseError(
400, f"'{preset_config}' is not a valid preset", errcode=Codes.BAD_JSON
)
creation_content.update({"creator": creator_id}) creation_content.update({"creator": creator_id})
await send(etype=EventTypes.Create, content=creation_content) await send(etype=EventTypes.Create, content=creation_content)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment