aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-12-21 08:19:58 +0100
committerKim Alvefur <zash@zash.se>2012-12-21 08:19:58 +0100
commit19473b8b72ce4060039e768f3c9255c15847c055 (patch)
treec69a58773307b6b4a2334740e2465344d048409e
parentbf297afdb61032b38c060eee47f2ca3f1aa07ad3 (diff)
downloadprosody-19473b8b72ce4060039e768f3c9255c15847c055.tar.gz
prosody-19473b8b72ce4060039e768f3c9255c15847c055.zip
mod_http_files: Make sure file extensions are not nil or empty string
-rw-r--r--plugins/mod_http_files.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua
index 47423f55..70ef5623 100644
--- a/plugins/mod_http_files.lua
+++ b/plugins/mod_http_files.lua
@@ -118,8 +118,8 @@ function serve_file(event, path)
if not data then
return 403;
end
- local ext = path:match("%.([^.]*)$");
- local content_type = mime_map[ext];
+ local ext = path:match("%.([^./]+)$");
+ local content_type = ext and mime_map[ext];
cache[path] = { data = data; content_type = content_type; };
response_headers.content_type = content_type;
end