mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-12 13:04:20 -05:00
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.
This commit is contained in:
parent
ecbfa4fe4f
commit
2cb85bdf75
1
changelog.d/10738.misc
Normal file
1
changelog.d/10738.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Additional error checking for the `preset` field when creating a room.
|
@ -909,7 +909,12 @@ class RoomCreationHandler(BaseHandler):
|
|||||||
)
|
)
|
||||||
return last_stream_id
|
return last_stream_id
|
||||||
|
|
||||||
|
try:
|
||||||
config = self._presets_dict[preset_config]
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user