mod_http_upload: Make loud noise if storage path can't be created or doesn't exist
authorKim Alvefur <zash@zash.se>
Thu, 29 Aug 2019 23:29:13 +0200
changeset 3661 3fb0add97cdb
parent 3660 3e0f4d727825
child 3662 02a1615d0392
mod_http_upload: Make loud noise if storage path can't be created or doesn't exist
mod_http_upload/mod_http_upload.lua
--- a/mod_http_upload/mod_http_upload.lua	Sun Aug 25 20:46:43 2019 +0200
+++ b/mod_http_upload/mod_http_upload.lua	Thu Aug 29 23:29:13 2019 +0200
@@ -104,7 +104,12 @@
 local pending_slots = module:shared("upload_slots");
 
 local storage_path = module:get_option_string(module.name .. "_path", join_path(prosody.paths.data, module.name));
-lfs.mkdir(storage_path);
+
+do
+	local ok, err, errno = lfs.mkdir(storage_path);
+	-- 17 should be EEXIST, which is fine
+	assert(ok or errno == 17, "Storage path must be writable by Prosody\n"..err);
+end
 
 local function expire(username, host)
 	if not max_age then return true; end