Diff

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
parent 2689:0fc706855af9
child 2691:92ddfc548ce8
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua	Sat Apr 15 15:52:54 2017 +0200
+++ b/mod_http_upload/mod_http_upload.lua	Sat Apr 15 15:53:46 2017 +0200
@@ -160,8 +160,13 @@
 	until lfs.mkdir(join_path(storage_path, random_dir))
 		or not lfs.attributes(join_path(storage_path, random_dir, filename))
 
-	datamanager.list_append(username, host, module.name, {
+	local ok = datamanager.list_append(username, host, module.name, {
 		filename = join_path(storage_path, random_dir, filename), size = filesize, time = os.time() });
+	if not ok then
+		origin.send(st.error_reply(stanza, "wait", "internal-server-failure"));
+		return true;
+	end
+
 	local slot = random_dir.."/"..filename;
 	pending_slots[slot] = origin.full_jid;