Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
5253:ad45612199e0 | 5254:df3552822054 |
---|---|
116 f:close(); | 116 f:close(); |
117 end | 117 end |
118 if not data then | 118 if not data then |
119 return 403; | 119 return 403; |
120 end | 120 end |
121 local ext = path:match("%.([^.]*)$"); | 121 local ext = path:match("%.([^./]+)$"); |
122 local content_type = mime_map[ext]; | 122 local content_type = ext and mime_map[ext]; |
123 cache[path] = { data = data; content_type = content_type; }; | 123 cache[path] = { data = data; content_type = content_type; }; |
124 response_headers.content_type = content_type; | 124 response_headers.content_type = content_type; |
125 end | 125 end |
126 | 126 |
127 return response:send(data); | 127 return response:send(data); |