Software /
code /
prosody
Diff
plugins/mod_http_files.lua @ 13873:8525b7c7ba6c
mod_http_files: Replace public API with errors
Modules wishing to serve files directly from the file system should be
using net.http.files instead, as per the error.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 13 May 2025 22:38:30 +0200 |
parent | 13213:50324f66ca2a |
child | 13874:bfa8ac5881a0 |
line wrap: on
line diff
--- a/plugins/mod_http_files.lua Mon May 05 17:30:06 2025 +0200 +++ b/plugins/mod_http_files.lua Tue May 13 22:38:30 2025 +0200 @@ -55,37 +55,12 @@ end -- COMPAT -- TODO deprecate -function serve(opts) - if type(opts) ~= "table" then -- assume path string - opts = { path = opts }; - end - if opts.directory_index == nil then - opts.directory_index = directory_index; - end - if opts.mime_map == nil then - opts.mime_map = mime_map; - end - if opts.cache_size == nil then - opts.cache_size = cache_size; - end - if opts.cache_max_file_size == nil then - opts.cache_max_file_size = cache_max_file_size; - end - if opts.index_files == nil then - opts.index_files = dir_indices; - end - module:log("warn", "%s should be updated to use 'prosody.net.http.files' instead of mod_http_files", get_calling_module()); - return fileserver.serve(opts); +function serve() + error(string.format("%s should be updated to use 'prosody.net.http.files' instead of mod_http_files", get_calling_module())); end -function wrap_route(routes) - module:log("debug", "%s should be updated to use 'prosody.net.http.files' instead of mod_http_files", get_calling_module()); - for route,handler in pairs(routes) do - if type(handler) ~= "function" then - routes[route] = fileserver.serve(handler); - end - end - return routes; +function wrap_route() + error(string.format("%s should be updated to use 'prosody.net.http.files' instead of mod_http_files", get_calling_module())); end module:provides("http", {