1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-04-20 02:26:45 +02: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 if user then
local ospath = require("vfs").ospath("home:///", user) local ospath = require("vfs").ospath("home:///", user)
if REQUEST and REQUEST.json then 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 if f then
f:write(REQUEST.json) f:write(REQUEST.json)
f:close() f:close()
os.execute("chmod o-r "..file_path)
result(true) result(true)
else else
fail("Cannot save setting") fail("Cannot save setting")