comparison mod_http_upload/mod_http_upload.lua @ 2690:43ad92c5b91a

mod_http_upload: Return an error if unable to store slot info
author Kim Alvefur <zash@zash.se>
date Sat, 15 Apr 2017 15:53:46 +0200
parents 0fc706855af9
children 92ddfc548ce8
comparison
equal deleted inserted replaced
2689:0fc706855af9 2690:43ad92c5b91a
158 local random_dir; 158 local random_dir;
159 repeat random_dir = uuid(); 159 repeat random_dir = uuid();
160 until lfs.mkdir(join_path(storage_path, random_dir)) 160 until lfs.mkdir(join_path(storage_path, random_dir))
161 or not lfs.attributes(join_path(storage_path, random_dir, filename)) 161 or not lfs.attributes(join_path(storage_path, random_dir, filename))
162 162
163 datamanager.list_append(username, host, module.name, { 163 local ok = datamanager.list_append(username, host, module.name, {
164 filename = join_path(storage_path, random_dir, filename), size = filesize, time = os.time() }); 164 filename = join_path(storage_path, random_dir, filename), size = filesize, time = os.time() });
165 if not ok then
166 origin.send(st.error_reply(stanza, "wait", "internal-server-failure"));
167 return true;
168 end
169
165 local slot = random_dir.."/"..filename; 170 local slot = random_dir.."/"..filename;
166 pending_slots[slot] = origin.full_jid; 171 pending_slots[slot] = origin.full_jid;
167 172
168 module:add_timer(900, function() 173 module:add_timer(900, function()
169 pending_slots[slot] = nil; 174 pending_slots[slot] = nil;