diff --git a/server/RdtClient.Service/Services/DownloadClient.cs b/server/RdtClient.Service/Services/DownloadClient.cs index d9aba21..23d0f1e 100644 --- a/server/RdtClient.Service/Services/DownloadClient.cs +++ b/server/RdtClient.Service/Services/DownloadClient.cs @@ -40,17 +40,16 @@ public class DownloadClient(Download download, Torrent torrent, String destinati var filePath = DownloadHelper.GetDownloadPath(destinationPath, torrent, download); var downloadPath = DownloadHelper.GetDownloadPath(torrent, download); + if (torrent.ClientKind == Torrent.TorrentClientKind.AllDebrid && Type == Data.Enums.DownloadClient.Symlink) + { + downloadPath = AllDebridTorrentClient.GetSymlinkPath(torrent, download); + } + if (filePath == null || downloadPath == null) { throw new("Invalid download path"); } - var symlinkSourcePath = torrent.ClientKind switch - { - Torrent.TorrentClientKind.AllDebrid => AllDebridTorrentClient.GetSymlinkPath(torrent, download), - _ => downloadPath - }; - Type = torrent.DownloadClient; if (Type != Data.Enums.DownloadClient.Symlink) @@ -63,7 +62,6 @@ public class DownloadClient(Download download, Torrent torrent, String destinati Data.Enums.DownloadClient.Internal => new InternalDownloader(download.Link, filePath), Data.Enums.DownloadClient.Bezzad => new BezzadDownloader(download.Link, filePath), Data.Enums.DownloadClient.Aria2c => new Aria2cDownloader(download.RemoteId, download.Link, filePath, downloadPath, category), - Data.Enums.DownloadClient.Symlink => new SymlinkDownloader(download.Link, filePath, symlinkSourcePath, torrent.ClientKind), Data.Enums.DownloadClient.Symlink => new SymlinkDownloader(download.Link, filePath, downloadPath, torrent.ClientKind), Data.Enums.DownloadClient.DownloadStation => await DownloadStationDownloader.Init(download.RemoteId, download.Link, filePath, downloadPath, category), _ => throw new($"Unknown download client {Type}") diff --git a/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs b/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs index 1eef8c2..9ab8875 100644 --- a/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs +++ b/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs @@ -426,7 +426,7 @@ public class AllDebridTorrentClient(ILogger logger, IHtt if (matchingTorrentFiles.Count == 0) { - throw new Exception($"Could not find file {fileName} in {torrent.RdName}"); + throw new($"Could not find file {fileName} in {torrent.RdName}"); } // Torrents with a single file in them don't need to have the `RdName` added