# HG changeset patch # User Kim Alvefur # Date 1611669115 -3600 # Node ID aade4a6179a3a1d26c092ce4aae377fd38dc55d5 # Parent 9edda2026e57d4abf7acd4e66bdfcf950cf2a419 mod_http_file_share: Return proper error if unauthorized diff -r 9edda2026e57 -r aade4a6179a3 plugins/mod_http_file_share.lua --- a/plugins/mod_http_file_share.lua Tue Jan 26 14:39:11 2021 +0100 +++ b/plugins/mod_http_file_share.lua Tue Jan 26 14:51:55 2021 +0100 @@ -34,10 +34,14 @@ module:depends("http"); end +local upload_errors = errors.init(module.name, namespace, { + access = { "auth"; "forbidden" }; +}); + function may_upload(uploader, filename, filesize, filetype) -- > boolean, error local uploader_host = jid.host(uploader); if not ((access:empty() and prosody.hosts[uploader_host]) or access:contains(uploader) or access:contains(uploader_host)) then - return false; + return false, upload_errors.new("access"); end return true;