From f56ce129e6e2a7fd94d2ff066c7b99ece5fa39e9 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 5 Jun 2021 14:55:43 -0400 Subject: [PATCH] Fixed: Push to client for Cardigann magnet links --- src/NzbDrone.Core/Download/TorrentClientBase.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/NzbDrone.Core/Download/TorrentClientBase.cs b/src/NzbDrone.Core/Download/TorrentClientBase.cs index b1ac80612..ad88d89f9 100644 --- a/src/NzbDrone.Core/Download/TorrentClientBase.cs +++ b/src/NzbDrone.Core/Download/TorrentClientBase.cs @@ -1,5 +1,6 @@ using System; using System.Net; +using System.Text; using System.Threading.Tasks; using MonoTorrent; using NLog; @@ -126,6 +127,20 @@ namespace NzbDrone.Core.Download torrentFile = await indexer.Download(new Uri(torrentUrl)); + // handle magnet URLs + if (torrentFile.Length >= 7 + && torrentFile[0] == 0x6d + && torrentFile[1] == 0x61 + && torrentFile[2] == 0x67 + && torrentFile[3] == 0x6e + && torrentFile[4] == 0x65 + && torrentFile[5] == 0x74 + && torrentFile[6] == 0x3a) + { + var magnetUrl = Encoding.UTF8.GetString(torrentFile); + return DownloadFromMagnetUrl(release, magnetUrl); + } + var filename = string.Format("{0}.torrent", StringUtil.CleanFileName(release.Title)); var hash = _torrentFileInfoReader.GetHashFromTorrentFile(torrentFile); var actualHash = AddFromTorrentFile(release, hash, filename, torrentFile);