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
|
||||
|
||||
import logging
|
||||
import string
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -50,6 +51,10 @@ class RoomCreationHandler(BaseHandler):
|
|||
self.ratelimit(user_id)
|
||||
|
||||
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(
|
||||
config["room_alias_name"],
|
||||
self.hs.hostname,
|
||||
|
|
Loading…
Reference in a new issue