mod_http_files: Log something if unable to load MIME database
authorKim Alvefur <zash@zash.se>
Mon, 23 Dec 2019 21:52:50 +0100
changeset 10552 c88f979946c4
parent 10551 c77471c180ea
child 10553 3e50f86e5a2e
mod_http_files: Log something if unable to load MIME database Not that much to worry about, the most common file types are included in the code above.
plugins/mod_http_files.lua
--- a/plugins/mod_http_files.lua	Mon Dec 23 21:52:28 2019 +0100
+++ b/plugins/mod_http_files.lua	Mon Dec 23 21:52:50 2019 +0100
@@ -33,7 +33,9 @@
 	module:shared("/*/http_files/mime").types = mime_map;
 
 	local mime_types, err = open(module:get_option_path("mime_types_file", "/etc/mime.types", "config"), "r");
-	if mime_types then
+	if not mime_types then
+		module:log("debug", "Could not open MIME database: %s", err);
+	else
 		local mime_data = mime_types:read("*a");
 		mime_types:close();
 		setmetatable(mime_map, {