comparison mod_http_upload/mod_http_upload.lua @ 3657:3fb0add97cdb

mod_http_upload: Make loud noise if storage path can't be created or doesn't exist
author Kim Alvefur <zash@zash.se>
date Thu, 29 Aug 2019 23:29:13 +0200
parents d252c8573f33
children 02a1615d0392
comparison
equal deleted inserted replaced
3656:3e0f4d727825 3657:3fb0add97cdb
102 102
103 -- state 103 -- state
104 local pending_slots = module:shared("upload_slots"); 104 local pending_slots = module:shared("upload_slots");
105 105
106 local storage_path = module:get_option_string(module.name .. "_path", join_path(prosody.paths.data, module.name)); 106 local storage_path = module:get_option_string(module.name .. "_path", join_path(prosody.paths.data, module.name));
107 lfs.mkdir(storage_path); 107
108 do
109 local ok, err, errno = lfs.mkdir(storage_path);
110 -- 17 should be EEXIST, which is fine
111 assert(ok or errno == 17, "Storage path must be writable by Prosody\n"..err);
112 end
108 113
109 local function expire(username, host) 114 local function expire(username, host)
110 if not max_age then return true; end 115 if not max_age then return true; end
111 local uploads, err = datamanager.list_load(username, host, module.name); 116 local uploads, err = datamanager.list_load(username, host, module.name);
112 if err then return false, err; end 117 if err then return false, err; end