Setting POE or USB to off caused 'Bad Gateway' (#264)

This commit is contained in:
Tim Wilkinson 2022-03-05 15:31:44 -08:00 committed by GitHub
parent 125f49d640
commit c1ab4f9a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -163,7 +163,7 @@ local settings = {
{ {
key = "aredn.@poe[0].passthrough", key = "aredn.@poe[0].passthrough",
type = "boolean", type = "boolean",
desc = "Specifies whether a PoE passthrough port should be on or off. (Not all devices have PoE passthrough ports.", desc = "Specifies whether a PoE passthrough port should be on or off. (Not all devices have PoE passthrough ports).",
default = "0", default = "0",
condition = "hasPOE()", condition = "hasPOE()",
postcallback = "setPOEOutput()" postcallback = "setPOEOutput()"
@ -171,7 +171,7 @@ local settings = {
{ {
key = "aredn.@usb[0].passthrough", key = "aredn.@usb[0].passthrough",
type = "boolean", type = "boolean",
desc = "Specifies whether the USB port should be on or off. (Not all devices have USB powered ports.", desc = "Specifies whether the USB port should be on or off. (Not all devices have USB powered ports).",
default = "1", default = "1",
postcallback = "setUSBOutput()", postcallback = "setUSBOutput()",
condition = "hasUSB()" condition = "hasUSB()"
@ -472,7 +472,11 @@ for i, setting in ipairs(settings)
do do
if parms["button_save_" .. i] then if parms["button_save_" .. i] then
newval = parms["newval_" .. i] newval = parms["newval_" .. i]
if not newval then
newval = ""
else
newval = newval:gsub("^%s+", ""):gsub("%s+$", "") newval = newval:gsub("^%s+", ""):gsub("%s+$", "")
end
if setting.type == "boolean" then if setting.type == "boolean" then
if newval == "1" or newval == "true" then if newval == "1" or newval == "true" then
newval = "1" newval = "1"