Comparison

mod_http_upload/mod_http_upload.lua @ 2470:9ff809591fbc

mod_http_upload: Accept already existing directory name if there is no conflicting file in it
author Kim Alvefur <zash@zash.se>
date Sun, 29 Jan 2017 17:32:40 +0100
parent 2469:43f7637f0143
child 2471:f48e9e25aec4
comparison
equal deleted inserted replaced
2469:43f7637f0143 2470:9ff809591fbc
85 local reply = st.reply(stanza); 85 local reply = st.reply(stanza);
86 reply:tag("slot", { xmlns = xmlns_http_upload }); 86 reply:tag("slot", { xmlns = xmlns_http_upload });
87 87
88 local random; 88 local random;
89 repeat random = uuid(); 89 repeat random = uuid();
90 until lfs.mkdir(join_path(storage_path, random)) 90 until lfs.mkdir(join_path(storage_path, random)) or not lfs.attributes(join_path(storage_path, random, filename))
91 91
92 pending_slots[random.."/"..filename] = origin.full_jid; 92 pending_slots[random.."/"..filename] = origin.full_jid;
93 local base_url = module:http_url(); 93 local base_url = module:http_url();
94 local slot_url = url.parse(base_url); 94 local slot_url = url.parse(base_url);
95 slot_url.path = url.parse_path(slot_url.path or "/"); 95 slot_url.path = url.parse_path(slot_url.path or "/");