# HG changeset patch # User Waqas Hussain # Date 1388872257 18000 # Node ID 854a3933cfcdb9eb8748ae2647c1274557fd7f24 # Parent 589991b148e89b8a9c8a5af214baeaf34ee7b1ad mod_muc_log_http: URL-encode room names. This allows special characters in room names to work. Ideally this escaping shouldn’t be done in the user visible content, but the module’s template system doesn’t currently allow that. diff -r 589991b148e8 -r 854a3933cfcd mod_muc_log_http/muc_log_http/mod_muc_log_http.lua --- a/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua Sat Jan 04 20:34:22 2014 +0100 +++ b/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua Sat Jan 04 16:50:57 2014 -0500 @@ -62,6 +62,9 @@ url = url:gsub("\r\n", "\n") return url end +local function urlencode(s) + return s and (s:gsub("[^a-zA-Z0-9.~_-]", function (c) return ("%%%02x"):format(c:byte()); end)); +end local function generate_room_list(component) local rooms = ""; @@ -70,7 +73,7 @@ for jid, room in pairs(component_host.muc.rooms) do local node = split_jid(jid); if not room._data.hidden and room._data.logging and node then - rooms = rooms .. html.rooms.bit:gsub("###ROOM###", node):gsub("###COMPONENT###", component); + rooms = rooms .. html.rooms.bit:gsub("###ROOM###", urlencode(node)):gsub("###COMPONENT###", component); end end return html.rooms.body:gsub("###ROOMS_STUFF###", rooms):gsub("###COMPONENT###", component), "Chatroom logs for "..component; @@ -242,7 +245,7 @@ found = 1 end - rooms = rooms .. html.days.rooms.bit:gsub("###ROOM###", node); + rooms = rooms .. html.days.rooms.bit:gsub("###ROOM###", urlencode(node)); end end