Mercurial > prosody-hg
comparison plugins/mod_http_file_share.lua @ 11317:79e1f407b6f5
mod_http_file_share: Expand registry to fix extra tag
Error registry compact format doesn't support extra.tag so needs to be
the more verbose format
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 27 Jan 2021 00:28:42 +0100 |
| parents | ae0461b37fbe |
| children | 3b16aba6285f |
comparison
equal
deleted
inserted
replaced
| 11316:ae0461b37fbe | 11317:79e1f407b6f5 |
|---|---|
| 41 { name = "FORM_TYPE", type = "hidden", value = namespace }, | 41 { name = "FORM_TYPE", type = "hidden", value = namespace }, |
| 42 { name = "max-file-size", type = "text-single" }, | 42 { name = "max-file-size", type = "text-single" }, |
| 43 }:form({ ["max-file-size"] = tostring(file_size_limit) }, "result")); | 43 }:form({ ["max-file-size"] = tostring(file_size_limit) }, "result")); |
| 44 | 44 |
| 45 local upload_errors = errors.init(module.name, namespace, { | 45 local upload_errors = errors.init(module.name, namespace, { |
| 46 access = { "auth"; "forbidden" }; | 46 access = { type = "auth"; condition = "forbidden" }; |
| 47 filename = { "modify"; "bad-request", "Invalid filename" }; | 47 filename = { type = "modify"; condition = "bad-request"; text = "Invalid filename" }; |
| 48 filetype = { "modify"; "not-acceptable", "File type not allowed" }; | 48 filetype = { type = "modify"; condition = "not-acceptable"; text = "File type not allowed" }; |
| 49 filesize = { "modify"; "not-acceptable"; "File too large"; | 49 filesize = { type = "modify"; condition = "not-acceptable"; text = "File too large"; |
| 50 st.stanza("file-too-large", {xmlns = namespace}):tag("max-size"):text(tostring(file_size_limit)); }; | 50 extra = {tag = st.stanza("file-too-large", {xmlns = namespace}):tag("max-size"):text(tostring(file_size_limit)) }; |
| 51 }; | |
| 51 }); | 52 }); |
| 52 | 53 |
| 53 function may_upload(uploader, filename, filesize, filetype) -- > boolean, error | 54 function may_upload(uploader, filename, filesize, filetype) -- > boolean, error |
| 54 local uploader_host = jid.host(uploader); | 55 local uploader_host = jid.host(uploader); |
| 55 if not ((access:empty() and prosody.hosts[uploader_host]) or access:contains(uploader) or access:contains(uploader_host)) then | 56 if not ((access:empty() and prosody.hosts[uploader_host]) or access:contains(uploader) or access:contains(uploader_host)) then |
