Software /
code /
prosody-modules
Comparison
mod_http_upload/mod_http_upload.lua @ 3649:d252c8573f33
mod_http_upload: Also format max file size as integer in error (thanks lovetox)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 23 Aug 2019 00:19:46 +0200 |
parent | 3648:aa12b95a6d36 |
child | 3657:3fb0add97cdb |
comparison
equal
deleted
inserted
replaced
3648:aa12b95a6d36 | 3649:d252c8573f33 |
---|---|
177 return nil, st.error_reply(stanza, "modify", "bad-request", "Missing or invalid file size"); | 177 return nil, st.error_reply(stanza, "modify", "bad-request", "Missing or invalid file size"); |
178 elseif filesize > file_size_limit then | 178 elseif filesize > file_size_limit then |
179 module:log("debug", "File too large (%d > %d)", filesize, file_size_limit); | 179 module:log("debug", "File too large (%d > %d)", filesize, file_size_limit); |
180 return nil, st.error_reply(stanza, "modify", "not-acceptable", "File too large") | 180 return nil, st.error_reply(stanza, "modify", "not-acceptable", "File too large") |
181 :tag("file-too-large", {xmlns=xmlns}) | 181 :tag("file-too-large", {xmlns=xmlns}) |
182 :tag("max-file-size"):text(tostring(file_size_limit)); | 182 :tag("max-file-size"):text(("%d"):format(file_size_limit)); |
183 elseif not check_quota(username, host, filesize) then | 183 elseif not check_quota(username, host, filesize) then |
184 module:log("debug", "Upload of %dB by %s would exceed quota", filesize, origin.full_jid); | 184 module:log("debug", "Upload of %dB by %s would exceed quota", filesize, origin.full_jid); |
185 return nil, st.error_reply(stanza, "wait", "resource-constraint", "Quota reached"); | 185 return nil, st.error_reply(stanza, "wait", "resource-constraint", "Quota reached"); |
186 end | 186 end |
187 | 187 |