mod_http_dir_listing: Fix file ending detection for filenames with more than one period and don't index mime types with nil
--- a/mod_http_dir_listing/http_dir_listing/mod_http_dir_listing.lua Sun Jun 30 20:14:28 2013 +0200
+++ b/mod_http_dir_listing/http_dir_listing/mod_http_dir_listing.lua Mon Jul 01 23:06:00 2013 +0200
@@ -40,8 +40,8 @@
if file:sub(1,1) ~= "." then
local attr = stat(full_path..file) or {};
local path = { file };
- local file_ext = file:match"%.(.-)$";
- local type = attr.mode == "file" and mime_map and mime_map[file_ext] or nil;
+ local file_ext = file:match"%.([^.]+)$";
+ local type = attr.mode == "file" and file_ext and mime_map and mime_map[file_ext] or nil;
local class = table.concat({ attr.mode or "unknown", file_ext, type and type:match"^[^/]+" }, " ");
path.is_directory = attr.mode == "directory";
filelist:tag("li", { class = class })