|
|
|
@ -26,6 +26,7 @@ namespace NzbDrone.Core.Indexers
|
|
|
|
|
if (link.Scheme == "magnet")
|
|
|
|
|
{
|
|
|
|
|
ValidateMagnet(link.OriginalString);
|
|
|
|
|
|
|
|
|
|
return Encoding.UTF8.GetBytes(link.OriginalString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -78,6 +79,8 @@ namespace NzbDrone.Core.Indexers
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ValidateTorrent(torrentData);
|
|
|
|
|
|
|
|
|
|
return torrentData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -85,5 +88,18 @@ namespace NzbDrone.Core.Indexers
|
|
|
|
|
{
|
|
|
|
|
MagnetLink.Parse(link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void ValidateTorrent(byte[] torrentData)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Torrent.Load(torrentData);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
_logger.Trace("Invalid torrent file contents: {0}", Encoding.ASCII.GetString(torrentData));
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|