mirror of
https://github.com/bjc/prosody.git
synced 2025-04-06 06:37:37 +03:00
mod_http_file_share: Return proper error if unauthorized
This commit is contained in:
parent
a28c769e1a
commit
2c09796dda
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue