Software /
code /
prosody
Comparison
tools/ejabberd2prosody.lua @ 628:3712d36b6d25
Fixed URL encoding to generate %0x instead of %x
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 16 Dec 2008 03:46:17 +0500 |
parent | 615:4ae3e81513f3 |
child | 643:8ff454831f7d |
comparison
equal
deleted
inserted
replaced
621:cd2cab5400fc | 628:3712d36b6d25 |
---|---|
35 function mkdir(path) | 35 function mkdir(path) |
36 path = path:gsub("/", path_separator); | 36 path = path:gsub("/", path_separator); |
37 --print("mkdir",path); | 37 --print("mkdir",path); |
38 local x = io.popen("mkdir "..path.." 2>&1"):read("*a"); | 38 local x = io.popen("mkdir "..path.." 2>&1"):read("*a"); |
39 end | 39 end |
40 function encode(s) return s and (s:gsub("%W", function (c) return string.format("%%%x", c:byte()); end)); end | 40 function encode(s) return s and (s:gsub("%W", function (c) return string.format("%%%02x", c:byte()); end)); end |
41 function getpath(username, host, datastore, ext) | 41 function getpath(username, host, datastore, ext) |
42 ext = ext or "dat"; | 42 ext = ext or "dat"; |
43 if username then | 43 if username then |
44 return format("%s/%s/%s/%s.%s", data_path, encode(host), datastore, encode(username), ext); | 44 return format("%s/%s/%s/%s.%s", data_path, encode(host), datastore, encode(username), ext); |
45 elseif host then | 45 elseif host then |