fix(downloadclient): qBittorrent url parse err handling (#1832)

* fix(downloadclient): qBittorrent url parse err handling

* fix(downloadclient): qBittorrent url parse err handling test
This commit is contained in:
ze0s 2024-11-24 00:53:59 +01:00 committed by GitHub
parent a18284ecc6
commit f54c51fa06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 8 deletions

View file

@ -71,8 +71,13 @@ func (s *service) testConnection(ctx context.Context, client domain.DownloadClie
}
func (s *service) testQbittorrentConnection(ctx context.Context, client domain.DownloadClient) error {
clientHost, err := client.BuildLegacyHost()
if err != nil {
return errors.Wrap(err, "error building qBittorrent host url: %s", client.Host)
}
qbtSettings := qbittorrent.Config{
Host: client.BuildLegacyHost(),
Host: clientHost,
TLSSkipVerify: client.TLSSkipVerify,
Username: client.Username,
Password: client.Password,

View file

@ -181,8 +181,13 @@ func (s *service) GetClient(ctx context.Context, clientId int32) (*domain.Downlo
switch client.Type {
case domain.DownloadClientTypeQbittorrent:
clientHost, err := client.BuildLegacyHost()
if err != nil {
return nil, errors.Wrap(err, "error building qBittorrent host url: %v", client.Host)
}
client.Client = qbittorrent.NewClient(qbittorrent.Config{
Host: client.BuildLegacyHost(),
Host: clientHost,
Username: client.Username,
Password: client.Password,
TLSSkipVerify: client.TLSSkipVerify,