mod_http_files: Make sure file extensions are not nil or empty string
authorKim Alvefur <zash@zash.se>
Fri, 21 Dec 2012 08:19:58 +0100
changeset 5254 df3552822054
parent 5253 ad45612199e0
child 5255 bf34f1ee08ee
mod_http_files: Make sure file extensions are not nil or empty string
plugins/mod_http_files.lua
--- a/plugins/mod_http_files.lua	Fri Dec 21 08:14:33 2012 +0100
+++ b/plugins/mod_http_files.lua	Fri Dec 21 08:19:58 2012 +0100
@@ -118,8 +118,8 @@
 		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