Changeset

344:2b0f2160fc61

mod_muc_log_http: Fix room name encoding/decoding (for UTF-8 room names)
author Joseph Wallace <JosephWallace@letu.edu>
date Sat, 05 Mar 2011 18:52:43 +0000
parents 343:845a59c99b4d
children 345:445178d15b51
files mod_muc_log_http/muc_log_http/mod_muc_log_http.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua	Thu Mar 03 15:27:39 2011 +0000
+++ b/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua	Sat Mar 05 18:52:43 2011 +0000
@@ -15,6 +15,8 @@
 local splitJid = require "util.jid".split;
 local config_get = require "core.configmanager".get;
 local httpserver = require "net.httpserver";
+local urlencode = require "net.http".urlencode;
+local urldecode = require "net.http".urldecode;
 local datamanager = require "util.datamanager";
 local data_load, data_getpath = datamanager.load, datamanager.getpath;
 local datastore = "muc_log";
@@ -288,6 +290,7 @@
 		year = year - 2000;
 	end
 	local bareDay = str_format("%.02d%.02d%.02d", year, month, day);
+       room = urlencode(room);
 	local attributes, err = lfs.attributes(path.."/"..bareDay.."/"..room..".dat")
 	if attributes ~= nil and attributes.mode == "file" then
 		local s = html.days.bit;
@@ -693,7 +696,9 @@
 
 function handle_request(method, body, request)
 	local node, host, day = splitUrl(request.url.path);
-	
+
+       node = urldecode(node);
+
 	if muc_hosts ~= nil and html.doc ~= nil then
 	 	if node ~= nil and host ~= nil then
 			local bare = node .. "@" .. host;