Throw error when creating room if alias contains whitespace #SYN-335
This commit is contained in:
parent
c37a6e151f
commit
0c894e1ebd
|
@ -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 New Issue