fixup! Allow for options containing commas
This commit is contained in:
parent
a5f1bb0821
commit
aa19e1cfd3
1 changed files with 7 additions and 3 deletions
10
src/uci.lua
10
src/uci.lua
|
@ -184,13 +184,17 @@ function set_value(module)
|
||||||
|
|
||||||
local target = p["value"]
|
local target = p["value"]
|
||||||
local force = p["force"]
|
local force = p["force"]
|
||||||
|
originaltype = type(target)
|
||||||
if (force == "option" and type(target) == "table") or type(target) == "table" and #target == 1 then
|
if ( force == "option" and type(target) == "table" ) or type(target) == "table" and #target == 1 and force~='list' then
|
||||||
target = table.concat(target, ',')
|
target = table.concat(target, ',')
|
||||||
elseif force == "list" and (type(target) == "string" or type(target) == "number" ) then
|
elseif force == "list" and ( type(target) ~= "table" or type(target) == "string" ) then
|
||||||
target = { target }
|
target = { target }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if force == "list" and type(target) ~= "table" then
|
||||||
|
module:fail_json({msg="original " .. originaltype .. " type is " .. type(target), message=message})
|
||||||
|
end
|
||||||
|
|
||||||
local values = {}
|
local values = {}
|
||||||
if path["option"] then
|
if path["option"] then
|
||||||
values[path["option"]] = target
|
values[path["option"]] = target
|
||||||
|
|
Loading…
Add table
Reference in a new issue