aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_http_files.lua5
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