mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Update mkdir.lua
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
function mkdir(dir)
|
||||
api = freeswitch.API();
|
||||
dir = dir:gsub([[\]], "/");
|
||||
|
||||
--retrieve allowed characters and then use it to sanitize the dir variable
|
||||
local allowed_chars = os.getenv("ALLOWED_CHARS") or "^%a%d%-%._~"
|
||||
dir = dir:gsub("[^" .. allowed_chars .. "]", "")
|
||||
|
||||
if (package.config:sub(1,1) == "/") then
|
||||
--unix
|
||||
cmd = [[mkdir -p "]] .. dir .. [["]];
|
||||
@@ -9,7 +14,7 @@
|
||||
--windows
|
||||
cmd = [[mkdir "]] .. dir .. [["]];
|
||||
end
|
||||
-- os.execute(cmd);
|
||||
api:executeString("system " .. cmd );
|
||||
os.execute(cmd);
|
||||
--api:executeString("system " .. cmd );
|
||||
return cmd;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user