From 9d574664727108551a0c2efdc6a9d1d6df2b305a Mon Sep 17 00:00:00 2001 From: Sam Heinz <54530346+asylumexp@users.noreply.github.com> Date: Sun, 16 Mar 2025 19:49:03 +1000 Subject: [PATCH] [TB] fix: download urls still not returning filename via HEAD. --- .../Services/TorrentClients/TorBoxTorrentClient.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs b/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs index e953193..72dd2e0 100644 --- a/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs +++ b/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs @@ -322,6 +322,15 @@ public class TorBoxTorrentClient(ILogger logger, IHttpClien { return fileName.Trim('"'); } + } else + { + if (response.Content.Headers.ContentType?.MediaType == "application/zip") + { + return $"download-{new Random().Next(1, 10001)}.zip"; + } else + { + logger.LogDebug($"Failed to get filename for URI {downloadUrl}"); + } } }