Merge pull request #5732 from anyuta1166/5731
luci-app-openvpn: fix openvpn config corruption on upload
This commit is contained in:
commit
3968f80c3c
2 changed files with 2 additions and 3 deletions
|
@ -31,8 +31,7 @@ function ovpn_upload()
|
||||||
|
|
||||||
http.setfilehandler(
|
http.setfilehandler(
|
||||||
function(meta, chunk, eof)
|
function(meta, chunk, eof)
|
||||||
local data = util.trim(chunk:gsub("\r\n", "\n")) .. "\n"
|
local data = chunk:gsub("\r\n", "\n")
|
||||||
data = util.trim(data:gsub("[\128-\255]", ""))
|
|
||||||
|
|
||||||
if not fp and meta and meta.name == "ovpn_file" then
|
if not fp and meta and meta.name == "ovpn_file" then
|
||||||
fp = io.open(file, "w")
|
fp = io.open(file, "w")
|
||||||
|
|
|
@ -51,7 +51,7 @@ function file.cfgvalue()
|
||||||
end
|
end
|
||||||
|
|
||||||
function file.write(self, section, data1)
|
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
|
end
|
||||||
|
|
||||||
function file.remove(self, section, value)
|
function file.remove(self, section, value)
|
||||||
|
|
Loading…
Reference in a new issue