Fix conversion of string bools to bools
This commit is contained in:
@@ -253,10 +253,10 @@ def checkRequest(server):
|
|||||||
if data[0]: return False
|
if data[0]: return False
|
||||||
else: continue
|
else: continue
|
||||||
#### Compatibility code ####
|
#### Compatibility code ####
|
||||||
# Accept anything in boolean fields but convert it to a
|
# Accept strings in boolean fields but convert it to a
|
||||||
# boolean, because old servers send some booleans as strings.
|
# boolean, because old servers sent some booleans as strings.
|
||||||
if data[1] == "bool":
|
if data[1] == "bool" and type(server[name]).__name__ == "str":
|
||||||
server[name] = True if server[name] else False
|
server[name] = True if server[name].lower() in ["true", "1"] else False
|
||||||
continue
|
continue
|
||||||
# clients_max was sent as a string instead of an integer
|
# clients_max was sent as a string instead of an integer
|
||||||
if name == "clients_max" and type(server[name]).__name__ == "str":
|
if name == "clients_max" and type(server[name]).__name__ == "str":
|
||||||
|
|||||||
Reference in New Issue
Block a user