# HG changeset patch # User Kim Alvefur # Date 1356074398 -3600 # Node ID df35528220544df2a65c714389cb48d8bf1856ec # Parent ad45612199e0db469ba6167ae033d13450b4e805 mod_http_files: Make sure file extensions are not nil or empty string diff -r ad45612199e0 -r df3552822054 plugins/mod_http_files.lua --- 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