diff options
author | Kim Alvefur <zash@zash.se> | 2012-12-23 11:17:44 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-12-23 11:17:44 +0100 |
commit | 4c66b3e2842de2c196fd3e3722861ff515e91969 (patch) | |
tree | ec7174a7035716c903c153fd910b7166437eecca /plugins | |
parent | f7bd5657eb6214748dad7c3c552ea52d13286e5b (diff) | |
download | prosody-4c66b3e2842de2c196fd3e3722861ff515e91969.tar.gz prosody-4c66b3e2842de2c196fd3e3722861ff515e91969.zip |
mod_http_files: Allow passing a string to serve()
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_http_files.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua index a96db7b6..f1ae4918 100644 --- a/plugins/mod_http_files.lua +++ b/plugins/mod_http_files.lua @@ -51,6 +51,9 @@ end 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 @@ end 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 |