aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-03-03 16:06:16 +0100
committerKim Alvefur <zash@zash.se>2016-03-03 16:06:16 +0100
commit1322d44e8dd886c16d3edf548af37c2e3d054480 (patch)
tree6ff9f371d84546013bcbbb7ad355b0230c37b46b /plugins
parenta6931a80e52b4bd32bf91d8d6163e82006972b83 (diff)
parent411cb70495af9f70588fa21cf6ca607e3bae9981 (diff)
downloadprosody-1322d44e8dd886c16d3edf548af37c2e3d054480.tar.gz
prosody-1322d44e8dd886c16d3edf548af37c2e3d054480.zip
Merge 0.10->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_http_files.lua11
-rw-r--r--plugins/mod_welcome.lua2
2 files changed, 9 insertions, 4 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua
index 0c542714..3b602495 100644
--- a/plugins/mod_http_files.lua
+++ b/plugins/mod_http_files.lua
@@ -56,6 +56,7 @@ end
local urldecode = require "util.http".urldecode;
function sanitize_path(path)
+ if not path then return end
local out = {};
local c = 0;
@@ -74,6 +75,9 @@ function sanitize_path(path)
out[c] = component;
end
end
+ if path:sub(-1,-1) == "/" then
+ out[c+1] = "";
+ end
return "/"..table.concat(out, "/");
end
@@ -88,12 +92,13 @@ function serve(opts)
local directory_index = opts.directory_index;
local function serve_file(event, path)
local request, response = event.request, event.response;
- path = sanitize_path(path);
- if not path then
+ local sanitized_path = sanitize_path(path);
+ if path and not sanitized_path then
return 400;
end
+ path = sanitized_path;
local orig_path = sanitize_path(request.path);
- local full_path = base_path .. (path and "/"..path or ""):gsub("/", path_sep);
+ local full_path = base_path .. (path or ""):gsub("/", path_sep);
local attr = stat(full_path:match("^.*[^\\/]")); -- Strip trailing path separator because Windows
if not attr then
return 404;
diff --git a/plugins/mod_welcome.lua b/plugins/mod_welcome.lua
index 9c0c821b..d74643de 100644
--- a/plugins/mod_welcome.lua
+++ b/plugins/mod_welcome.lua
@@ -7,7 +7,7 @@
--
local host = module:get_host();
-local welcome_text = module:get_option("welcome_message") or "Hello $username, welcome to the $host IM server!";
+local welcome_text = module:get_option_string("welcome_message", "Hello $username, welcome to the $host IM server!");
local st = require "util.stanza";