Diff

mod_http_upload/mod_http_upload.lua @ 2471:f48e9e25aec4

mod_http_upload: Generate shorter random directory names (see #822)
author Kim Alvefur <zash@zash.se>
date Sun, 29 Jan 2017 17:27:24 +0100
parent 2470:9ff809591fbc
child 2472:595d6a25bd7a
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua	Sun Jan 29 17:32:40 2017 +0100
+++ b/mod_http_upload/mod_http_upload.lua	Sun Jan 29 17:27:24 2017 +0100
@@ -10,7 +10,7 @@
 -- imports
 local st = require"util.stanza";
 local lfs = require"lfs";
-local uuid = require"util.uuid".generate;
+local random_hex = require"util.uuid".get_nibbles;
 local url = require "socket.url";
 local dataform = require "util.dataforms".new;
 local t_concat = table.concat;
@@ -86,7 +86,7 @@
 	reply:tag("slot", { xmlns = xmlns_http_upload });
 
 	local random;
-	repeat random = uuid();
+	repeat random = random_hex(12);
 	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;