Software /
code /
prosody
Changeset
5268:69964d1cbe66
mod_http_files: Allow passing a string to serve()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 23 Dec 2012 11:17:44 +0100 |
parents | 5267:a2080e5c4eda |
children | 5269:7bc52402966d |
files | plugins/mod_http_files.lua |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_http_files.lua Sat Dec 22 14:20:12 2012 +0100 +++ b/plugins/mod_http_files.lua Sun Dec 23 11:17:44 2012 +0100 @@ -51,6 +51,9 @@ local cache = setmetatable({}, { __mode = "kv" }); -- Let the garbage collector have it if it wants to. function serve(opts) + if type(opts) ~= "table" then -- assume path string + opts = { path = opts }; + end local base_path = opts.path; local dir_indices = opts.index_files or dir_indices; local directory_index = opts.directory_index; @@ -128,7 +131,7 @@ function wrap_route(routes) for route,handler in pairs(routes) do - if type(handler) == "table" and handler.path then + if type(handler) ~= "function" then routes[route] = serve(handler); end end