Changeset

5254:df3552822054

mod_http_files: Make sure file extensions are not nil or empty string
author Kim Alvefur <zash@zash.se>
date Fri, 21 Dec 2012 08:19:58 +0100
parents 5253:ad45612199e0
children 5255:bf34f1ee08ee
files plugins/mod_http_files.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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