# HG changeset patch # User Kim Alvefur # Date 1491257179 -7200 # Node ID cfb7936ff61ff4a358ecb1f6b67ed30f6550b0f5 # Parent 5b97b04e9d1b15ced038a12e01a85b84cac1f281 mod_http_upload: Use the new util.id if available (in 0.10+) diff -r 5b97b04e9d1b -r cfb7936ff61f mod_http_upload/mod_http_upload.lua --- a/mod_http_upload/mod_http_upload.lua Mon Apr 03 16:15:15 2017 +0200 +++ b/mod_http_upload/mod_http_upload.lua Tue Apr 04 00:06:19 2017 +0200 @@ -16,14 +16,10 @@ local t_concat = table.concat; local t_insert = table.insert; local s_upper = string.upper; -local have_random, random = pcall(require, "util.random"); -- Only available in 0.10+ +local have_id, id = pcall(require, "util.id"); -- Only available in 0.10+ local uuid = require"util.uuid".generate; -if have_random then - local b64 = require "util.encodings".base64.encode; - local b64url = { ['+'] = '-', ['/'] = '_', ['='] = '' }; - function uuid() - return (b64(random.bytes(8)):gsub("[+/=]", b64url)); - end +if have_id then + uuid = id.medium(); end local function join_path(...) -- COMPAT util.path was added in 0.10