Skip to content
Permalink
Browse files

Compatibility fix (string field conversion)

  • Loading branch information
nOOb3167 authored and sfan5 committed May 18, 2018
1 parent 4802010 commit e49da8f1b9e00af1cf467b8eeeb34b819bc6aeaf
Showing with 3 additions and 2 deletions.
  1. +3 −2 server.py
@@ -209,8 +209,9 @@ def checkRequest(server):
if data[1] == "bool" and type(server[name]).__name__ == "str":
server[name] = True if server[name].lower() in ("true", "1") else False
continue
# clients_max was sent as a string instead of an integer
if name == "clients_max" and type(server[name]).__name__ == "str":
# Accept strings in integer fields but convert it to an
# integer, for interoperability with e.g. minetest.write_json.
if data[1] == "int" and type(server[name]).__name__ == "str":
server[name] = int(server[name])
continue
#### End compatibility code ####

0 comments on commit e49da8f

Please sign in to comment.