aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http_file_share.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-01-26 14:51:55 +0100
committerKim Alvefur <zash@zash.se>2021-01-26 14:51:55 +0100
commit62f77b9ac97454a783a003c47c84761100c37237 (patch)
tree8bfe24ddc3e327f7034b3e25e2a74b6159a7dbe1 /plugins/mod_http_file_share.lua
parent112b174e2d4449c81ad51acad7db7a8057e95ab9 (diff)
downloadprosody-62f77b9ac97454a783a003c47c84761100c37237.tar.gz
prosody-62f77b9ac97454a783a003c47c84761100c37237.zip
mod_http_file_share: Return proper error if unauthorized
Diffstat (limited to 'plugins/mod_http_file_share.lua')
-rw-r--r--plugins/mod_http_file_share.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua
index 8f230ef4..4c9dc9e9 100644
--- a/plugins/mod_http_file_share.lua
+++ b/plugins/mod_http_file_share.lua
@@ -34,10 +34,14 @@ if not external_base_url then
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;