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.
--- 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