Software /
code /
prosody-modules
Comparison
mod_http_upload/mod_http_upload.lua @ 4610:342664061c9b
mod_http_upload: Fix issuing slots to components or other non-c2s sessions
The 'full_jid' property only exists on local c2s sessions. This was not
adjusted for in 0a56dc6c61af, so it did not work.
Thanks Fren__ for highlighting the issue.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 01 Jul 2021 16:17:35 +0200 |
parent | 4443:0a56dc6c61af |
child | 4653:2b6e8ce5fb30 |
comparison
equal
deleted
inserted
replaced
4609:fcfe691d6322 | 4610:342664061c9b |
---|---|
193 module:log("debug", "File too large (%d > %d)", filesize, file_size_limit); | 193 module:log("debug", "File too large (%d > %d)", filesize, file_size_limit); |
194 return nil, st.error_reply(stanza, "modify", "not-acceptable", "File too large") | 194 return nil, st.error_reply(stanza, "modify", "not-acceptable", "File too large") |
195 :tag("file-too-large", {xmlns=xmlns}) | 195 :tag("file-too-large", {xmlns=xmlns}) |
196 :tag("max-file-size"):text(("%d"):format(file_size_limit)); | 196 :tag("max-file-size"):text(("%d"):format(file_size_limit)); |
197 elseif not check_quota(username, host, filesize) then | 197 elseif not check_quota(username, host, filesize) then |
198 module:log("debug", "Upload of %dB by %s would exceed quota", filesize, origin.full_jid); | 198 module:log("debug", "Upload of %dB by %s would exceed quota", filesize, user_bare); |
199 return nil, st.error_reply(stanza, "wait", "resource-constraint", "Quota reached"); | 199 return nil, st.error_reply(stanza, "wait", "resource-constraint", "Quota reached"); |
200 end | 200 end |
201 | 201 |
202 local random_dir = uuid(); | 202 local random_dir = uuid(); |
203 local created, err = lfs.mkdir(join_path(storage_path, random_dir)); | 203 local created, err = lfs.mkdir(join_path(storage_path, random_dir)); |
213 if not ok then | 213 if not ok then |
214 return nil, st.error_reply(stanza, "wait", "internal-server-error"); | 214 return nil, st.error_reply(stanza, "wait", "internal-server-error"); |
215 end | 215 end |
216 | 216 |
217 local slot = random_dir.."/"..filename; | 217 local slot = random_dir.."/"..filename; |
218 pending_slots[slot] = origin.full_jid; | 218 pending_slots[slot] = user_bare; |
219 | 219 |
220 module:add_timer(900, function() | 220 module:add_timer(900, function() |
221 pending_slots[slot] = nil; | 221 pending_slots[slot] = nil; |
222 end); | 222 end); |
223 | 223 |