From 9eddee75ca6534bfd0d8d5e0319213f997edbb43 Mon Sep 17 00:00:00 2001 From: Apurv404 Date: Sat, 2 Apr 2022 01:34:54 +0530 Subject: [PATCH] Fix room alias issue (#354) --- src/ChatPage.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index 8dbba488..e6b6235b 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -749,6 +749,13 @@ ChatPage::joinRoomVia(const std::string &room_id, void ChatPage::createRoom(const mtx::requests::CreateRoom &req) { + if (req.room_alias_name.find(":") != std::string::npos || + req.room_alias_name.find("#") != std::string::npos) { + nhlog::net()->warn("Failed to create room: Some characters are not allowed in alias"); + emit this->showNotification(tr("Room creation failed: Bad Alias")); + return; + } + http::client()->create_room( req, [this](const mtx::responses::CreateRoom &res, mtx::http::RequestErr err) { if (err) {