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

Merge pull request #37 from lxsang/master

setting file should not be readable by other user
This commit is contained in:
Xuan Sang LE 2021-01-02 13:51:55 +01:00 committed by GitHub
commit a361a475c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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")