Software /
code /
prosody
Diff
plugins/mod_http_files.lua @ 5254:df3552822054
mod_http_files: Make sure file extensions are not nil or empty string
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 21 Dec 2012 08:19:58 +0100 |
parent | 5253:ad45612199e0 |
child | 5255:bf34f1ee08ee |
line wrap: on
line diff
--- 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