Fixed: qBittorrent /login API success check

This commit is contained in:
Polgonite 2025-10-22 06:05:53 +02:00 committed by GitHub
parent 52d7f67627
commit 5a3f41263a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -434,8 +434,8 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSe
}
catch (HttpException ex)
{
_logger.Debug("qbitTorrent authentication failed.");
if (ex.Response.StatusCode == HttpStatusCode.Forbidden)
_logger.Debug(ex, "qbitTorrent authentication failed.");
if (ex.Response.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
{
throw new DownloadClientAuthenticationException("Failed to authenticate with qBittorrent.", ex);
}
@ -447,7 +447,7 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSe
throw new DownloadClientUnavailableException("Failed to connect to qBittorrent, please check your settings.", ex);
}
if (response.Content != "Ok.")
if (response.Content.IsNotNullOrWhiteSpace() && response.Content != "Ok.")
{
// returns "Fails." on bad login
_logger.Debug("qbitTorrent authentication failed.");