mirror of
https://github.com/YunoHost/check-http.git
synced 2024-09-03 19:56:42 +02:00
Fix port format validation
This commit is contained in:
parent
9156050073
commit
47c41cab06
1 changed files with 1 additions and 1 deletions
|
@ -264,7 +264,7 @@ async def check_ports(request):
|
||||||
|
|
||||||
def is_port_number(p):
|
def is_port_number(p):
|
||||||
return isinstance(p, int) and p > 0 and p < 65535
|
return isinstance(p, int) and p > 0 and p < 65535
|
||||||
assert all(not is_port_number(p) for p in data["ports"]), "'ports' should a list of valid port numbers"
|
assert all(is_port_number(p) for p in data["ports"]), "'ports' should a list of valid port numbers"
|
||||||
except AssertionError as e:
|
except AssertionError as e:
|
||||||
logger.info(f"Invalid request: {e} ... Original request body was: {request.body}")
|
logger.info(f"Invalid request: {e} ... Original request body was: {request.body}")
|
||||||
return json_response({
|
return json_response({
|
||||||
|
|
Loading…
Reference in a new issue