From e21dc7279a7726b316d711b981541809f9fd9469 Mon Sep 17 00:00:00 2001 From: Sam Heinz <54530346+asylumexp@users.noreply.github.com> Date: Sat, 28 Dec 2024 01:36:21 +1000 Subject: [PATCH] [TB] Fix Index was out of range error put < when shouldve put > --- .../TorrentClients/TorBoxTorrentClient.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs b/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs index 7a523e7..765e535 100644 --- a/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs +++ b/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs @@ -40,20 +40,20 @@ public class TorBoxTorrentClient(ILogger logger, IHttpClien { foreach (var inner in ae.InnerExceptions) { - logger.LogError(inner, $"The connection to RealDebrid has failed: {inner.Message}"); + logger.LogError(inner, $"The connection to TorBox has failed: {inner.Message}"); } throw; } catch (TaskCanceledException ex) when (ex.InnerException is TimeoutException) { - logger.LogError(ex, $"The connection to RealDebrid has timed out: {ex.Message}"); + logger.LogError(ex, $"The connection to TorBox has timed out: {ex.Message}"); throw; } catch (TaskCanceledException ex) { - logger.LogError(ex, $"The connection to RealDebrid has timed out: {ex.Message}"); + logger.LogError(ex, $"The connection to TorBox has timed out: {ex.Message}"); throw; } @@ -161,17 +161,16 @@ public class TorBoxTorrentClient(ILogger logger, IHttpClien { var availability = await GetClient().Torrents.GetAvailabilityAsync(hash, listFiles: true); - if (availability.Data != null || availability.Data?.Count < 0) + if (availability.Data != null && availability.Data.Count > 0) { return (availability.Data[0]?.Files ?? []).Select(file => new TorrentClientAvailableFile - { - Filename = file.Name, - Filesize = file.Size - }) - .ToList(); + { + Filename = file.Name, + Filesize = file.Size + }).ToList(); } - return []; + return new List(); } public Task SelectFiles(Data.Models.Data.Torrent torrent)