Opened 3 years ago

Last modified 14 months ago

#3505 new bug

Cannot add host on deluge-console (invalid port)

Reported by: tremby Owned by:
Priority: major Milestone: 2.1.1
Component: Console UI Version: 2.0.3
Keywords: fix Cc:

Description

The "add host" option in deluge-console does not work.

I think the integer validation intended for the port field is checking the contents of the host field, or something similar.

If I type in a string in the host field and a number in the port field, I get "Error adding host -- localhost: Invalid port. Must be an integer".

Interestingly, if I fill the port number in to the host field, and the hostname in to the port field, I get "58846: Invalid port. Must be an integer".

Change History (5)

comment:1 by Calum, 3 years ago

Milestone: needs verified2.1.0

comment:2 by KtlTheBest, 3 years ago

Good time of the day. I am currently looking into the problem, but the quick analysis shows that there is no conversion of port value to integer.

There is a _do_add(result, **kwargs) method in ui/console/modes/connectionmanager.py which then calls add_host(hostname, port, username, password) method from the same class, which in turn calls the add_host() from the Hostlist() class which is located in ui/hostlist.py which then raises the Exception.

The question is, at what stage does the conversion from the str to int must happen?

Best regards, KtlTheBest

comment:3 by Calum, 3 years ago

In the console connectionmanager I can see it is using add_text_input, could try replacing it with an int input field e.g. add_int_spin_input

comment:4 by Calum, 2 years ago

Milestone: 2.1.02.1.1

Ticket retargeted after milestone closed

comment:5 by Chakib Benziane, 14 months ago

Keywords: fix added

This fixed it for me:

   # cast port to int in ui/console/modes/connectionmanager.py
   self.hostlist.add_host(hostname, int(port), username, password)
Last edited 14 months ago by Chakib Benziane (previous) (diff)
Note: See TracTickets for help on using tickets.