luci-app-openvpn: fix openvpn config corruption on upload

Signed-off-by: Anna Tikhomirova <vamp@vampik.ru>
This commit is contained in:
Anna Tikhomirova 2022-03-20 02:24:42 +03:00
parent f27fe280aa
commit 64b80b8f11
2 changed files with 2 additions and 3 deletions

View file

@ -31,8 +31,7 @@ function ovpn_upload()
http.setfilehandler(
function(meta, chunk, eof)
local data = util.trim(chunk:gsub("\r\n", "\n")) .. "\n"
data = util.trim(data:gsub("[\128-\255]", ""))
local data = chunk:gsub("\r\n", "\n")
if not fp and meta and meta.name == "ovpn_file" then
fp = io.open(file, "w")

View file

@ -51,7 +51,7 @@ function file.cfgvalue()
end
function file.write(self, section, data1)
return fs.writefile(cfg_file, "\n" .. util.trim(data1:gsub("\r\n", "\n")) .. "\n")
return fs.writefile(cfg_file, util.trim(data1:gsub("\r\n", "\n")) .. "\n")
end
function file.remove(self, section, value)