1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00

setting file should not be readable by other user

This commit is contained in:
lxsang 2020-12-27 11:49:29 +01:00
parent 0e3cf187be
commit edac98ca81

View File

@ -53,10 +53,12 @@ function SystemController:settings(...)
if user then
local ospath = require("vfs").ospath("home:///", user)
if REQUEST and REQUEST.json then
local f = io.open(ospath .. "/" .. ".settings.json", "w")
local file_path = ospath .. "/" .. ".settings.json"
local f = io.open(file_path, "w")
if f then
f:write(REQUEST.json)
f:close()
os.execute("chmod o-r "..file_path)
result(true)
else
fail("Cannot save setting")