From 62f77b9ac97454a783a003c47c84761100c37237 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 26 Jan 2021 14:51:55 +0100 Subject: mod_http_file_share: Return proper error if unauthorized --- plugins/mod_http_file_share.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') 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; -- cgit v1.2.3