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
commit0ff07edb453e5afd98e7236ed467034bf9fb4e33 (patch)
treec69a58773307b6b4a2334740e2465344d048409e
parentdc08340e9f78c5f76e22b981cdaacc3ee0b30729 (diff)
downloadprosody-0ff07edb453e5afd98e7236ed467034bf9fb4e33.tar.gz
prosody-0ff07edb453e5afd98e7236ed467034bf9fb4e33.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