# HG changeset patch # User Kim Alvefur # Date 1372712760 -7200 # Node ID 754c15641369db59b17e8a703c6b672bb5bd6fd7 # Parent cbbeac61f1ab165b7aea70b2f9470f5d4b71a565 mod_http_dir_listing: Fix file ending detection for filenames with more than one period and don't index mime types with nil diff -r cbbeac61f1ab -r 754c15641369 mod_http_dir_listing/http_dir_listing/mod_http_dir_listing.lua --- 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 })