Fixed: Push to client for Cardigann magnet links

pull/101/head
Qstick 3 years ago
parent ae9930a03f
commit f56ce129e6

@ -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);

Loading…
Cancel
Save