mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-21 11:24:01 +01:00
Throw error when creating room if alias contains whitespace #SYN-335
This commit is contained in:
parent
c37a6e151f
commit
0c894e1ebd
1 changed files with 5 additions and 0 deletions
|
@ -26,6 +26,7 @@ from synapse.util.async import run_on_reactor
|
||||||
from synapse.events.utils import serialize_event
|
from synapse.events.utils import serialize_event
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import string
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -50,6 +51,10 @@ class RoomCreationHandler(BaseHandler):
|
||||||
self.ratelimit(user_id)
|
self.ratelimit(user_id)
|
||||||
|
|
||||||
if "room_alias_name" in config:
|
if "room_alias_name" in config:
|
||||||
|
for wchar in string.whitespace:
|
||||||
|
if wchar in config["room_alias_name"]:
|
||||||
|
raise SynapseError(400, "Invalid characters in room alias")
|
||||||
|
|
||||||
room_alias = RoomAlias.create(
|
room_alias = RoomAlias.create(
|
||||||
config["room_alias_name"],
|
config["room_alias_name"],
|
||||||
self.hs.hostname,
|
self.hs.hostname,
|
||||||
|
|
Loading…
Reference in a new issue