Changeset

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
parents 2469:43f7637f0143
children 2471:f48e9e25aec4
files mod_http_upload/mod_http_upload.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua	Sun Jan 29 17:31:28 2017 +0100
+++ b/mod_http_upload/mod_http_upload.lua	Sun Jan 29 17:32:40 2017 +0100
@@ -87,7 +87,7 @@
 
 	local random;
 	repeat random = uuid();
-	until lfs.mkdir(join_path(storage_path, random))
+	until lfs.mkdir(join_path(storage_path, random)) or not lfs.attributes(join_path(storage_path, random, filename))
 
 	pending_slots[random.."/"..filename] = origin.full_jid;
 	local base_url = module:http_url();