mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
number validator accepts hex numbers
This commit is contained in:
@@ -70,7 +70,13 @@ def valid_number(
|
||||
|
||||
arg = valid_stripped_string_not_empty(arg, name)
|
||||
try:
|
||||
arg = type(arg)
|
||||
if type == int:
|
||||
if arg.startswith(("0x", "0X")):
|
||||
arg = int(arg[2:], 16)
|
||||
else:
|
||||
arg = int(arg)
|
||||
else:
|
||||
arg = type(arg)
|
||||
except Exception:
|
||||
raise_error(arg, name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user