Changeset

117:ecf05eb2d833

mod_muc_log_http: support even more evil url stuff, don't forget %-signs
author Thilo Cestonaro <thilo@cestona.ro>
date Thu, 14 Jan 2010 15:40:10 +0100
parents 116:f68a781efe81
children 118:7eadcf0a0190
files mod_muc_log_http/muc_log_http/mod_muc_log_http.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua	Thu Jan 14 12:54:44 2010 +0100
+++ b/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua	Thu Jan 14 15:40:10 2010 +0100
@@ -68,6 +68,7 @@
 
 function createDoc(body)
 	if body then
+		body = body:gsub("%%", "%%%%");
 		return html.doc:gsub("###BODY_STUFF###", body);
 	end
 end
@@ -82,11 +83,12 @@
 local function htmlEscape(t)
 	t = t:gsub("<", "&lt;");
 	t = t:gsub(">", "&gt;");
-	t = t:gsub("(http://[%a%d@%.:/&%?=%-_#%%]+)", function(h)
+	t = t:gsub("(http://[%a%d@%.:/&%?=%-_#%%~]+)", function(h)
 		h = urlunescape(h)
 		return "<a href='" .. h .. "'>" .. h .. "</a>";
 	end);
 	t = t:gsub("\n", "<br />");
+	t = t:gsub("%%", "%%%%");
 	return t;
 end
 
@@ -583,7 +585,7 @@
 			if previousDay then
 				previousDay = html.day.dayLink:gsub("###DAY###", previousDay):gsub("###TEXT###", "&lt;&lt; previous day");
 			end
-			tmp = html.day.body:gsub("###DAY_STUFF###", ret):gsub("###JID###", bareRoomJid);
+			tmp = html.day.body:gsub("###DAY_STUFF###", ret:gsub("%%", "%%%%")):gsub("###JID###", bareRoomJid);
 			tmp = tmp:gsub("###YEAR###", year):gsub("###MONTH###", month):gsub("###DAY###", day);
 			tmp = tmp:gsub("###TITLE_STUFF###", html.day.title:gsub("###TITLE###", roomSubject));
 			tmp = tmp:gsub("###STATUS_CHECKED###", config.showStatus and "checked='checked'" or "");