From 543fce4f296d65526c746e2bf8ba7a89c906ff87 Mon Sep 17 00:00:00 2001 From: DjLegolas Date: Mon, 1 Aug 2022 20:08:45 +0300 Subject: [PATCH] [console] Fix add host in connection manager The input is being passed as `str` instead of `int`, so added a conversion only if the string is indeed a decimal number. In addition, closing the add host popup after adding it. Closes: https://dev.deluge-torrent.org/ticket/3538 --- deluge/ui/console/modes/connectionmanager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deluge/ui/console/modes/connectionmanager.py b/deluge/ui/console/modes/connectionmanager.py index 0ccdd93db..6cf5e79b5 100644 --- a/deluge/ui/console/modes/connectionmanager.py +++ b/deluge/ui/console/modes/connectionmanager.py @@ -127,12 +127,14 @@ class ConnectionManager(BaseMode, PopupsHandler): def add_host(self, hostname, port, username, password): log.info('Adding host: %s', hostname) + if port.isdecimal(): + port = int(port) try: self.hostlist.add_host(hostname, port, username, password) except ValueError as ex: self.report_message(_('Error adding host'), f'{hostname}: {ex}') else: - self.update_select_host_popup() + self.pop_popup() def delete_host(self, host_id): log.info('Deleting host: %s', host_id)