changeset 1099:754c15641369

mod_http_dir_listing: Fix file ending detection for filenames with more than one period and don't index mime types with nil
author Kim Alvefur <zash@zash.se>
date Mon, 01 Jul 2013 23:06:00 +0200
parents cbbeac61f1ab
children aa93cf0b1242
files mod_http_dir_listing/http_dir_listing/mod_http_dir_listing.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 })