Changeset

1966:3b748666ff97

mod_http_upload: URL-encode filename in case it contains characters that need escaping (thanks Thilo)
author Kim Alvefur <zash@zash.se>
date Fri, 11 Dec 2015 18:00:43 +0100
parents 1965:3d8e2480fae0
children 1967:2ce2b194d501
files mod_http_upload/mod_http_upload.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua	Thu Dec 10 23:32:02 2015 +0100
+++ b/mod_http_upload/mod_http_upload.lua	Fri Dec 11 18:00:43 2015 +0100
@@ -11,6 +11,7 @@
 local st = require"util.stanza";
 local lfs = require"lfs";
 local uuid = require"util.uuid".generate;
+local urlencode = require"util.http".urlencode;
 local t_concat = table.concat;
 local t_insert = table.insert;
 local s_upper = string.upper;
@@ -66,7 +67,7 @@
 	reply:tag("slot", { xmlns = xmlns_http_upload });
 	local random = uuid();
 	pending_slots[random.."/"..filename] = origin.full_jid;
-	local url = module:http_url() .. "/" .. random .. "/" .. filename;
+	local url = module:http_url() .. "/" .. random .. "/" .. urlencode(filename);
 	reply:tag("get"):text(url):up();
 	reply:tag("put"):text(url):up();
 	origin.send(reply);