summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDjLegolas <djlegolas@protonmail.com>2022-08-01 20:02:18 +0300
committerCalum Lind <calumlind+deluge@gmail.com>2023-02-27 17:39:00 +0000
commit38feea0fa46913de8a070a6c19669d07df596571 (patch)
treecfce611679ed36dfdcd481ad7b61c7556b54d1a0
parent7af584d64976daaf27bf3daf0a5f896c9a25f5eb (diff)
downloaddeluge-38feea0fa46913de8a070a6c19669d07df596571.tar.gz
deluge-38feea0fa46913de8a070a6c19669d07df596571.tar.bz2
deluge-38feea0fa46913de8a070a6c19669d07df596571.zip
[hostlist] Add port value validation
When in console, and adding a new host with an invalid port number, the console starts printing many exceptions regarding the value. Therefor, we will make sure that the port value is between 0 and 65535.
-rw-r--r--deluge/ui/hostlist.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/deluge/ui/hostlist.py b/deluge/ui/hostlist.py
index 0fc3eabd8..0dba1269e 100644
--- a/deluge/ui/hostlist.py
+++ b/deluge/ui/hostlist.py
@@ -50,6 +50,8 @@ def validate_host_info(hostname, port):
if not isinstance(port, int):
raise ValueError('Invalid port. Must be an integer')
+ if not 0 <= port <= 65535:
+ raise ValueError('Invalid port. Must be between 0-65535')
def migrate_hostlist(old_filename, new_filename):