* luci/libs: fix datatype validation of list values
This commit is contained in:
parent
50a1f999ce
commit
e5608ae6b2
1 changed files with 9 additions and 5 deletions
|
@ -305,12 +305,16 @@ function UVL._validate_option( self, option, nodeps )
|
||||||
|
|
||||||
if item.datatype and val then
|
if item.datatype and val then
|
||||||
if self.datatypes[item.datatype] then
|
if self.datatypes[item.datatype] then
|
||||||
if not self.datatypes[item.datatype]( val ) then
|
val = ( type(val) == "table" and val or { val } )
|
||||||
return false, 'Value "' .. ( val or '<nil>' ) ..
|
for i, v in ipairs(val) do
|
||||||
|
if not self.datatypes[item.datatype]( v ) then
|
||||||
|
return false, 'Value' .. ( #val>1 and ' #'..i or '' ) ..
|
||||||
|
' "' .. ( v or '<nil>' ) ..
|
||||||
'" of given option "' .. option:cid() ..
|
'" of given option "' .. option:cid() ..
|
||||||
'" does not validate as datatype "' ..
|
'" does not validate as datatype "' ..
|
||||||
item.datatype .. '"'
|
item.datatype .. '"'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return false, 'Unknown datatype "' ..
|
return false, 'Unknown datatype "' ..
|
||||||
item.datatype .. '" encountered'
|
item.datatype .. '" encountered'
|
||||||
|
|
Loading…
Reference in a new issue