mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 13:57:11 -04:00
Fixed: (TorrentIndexerBase) Validate downloaded torrent data
This commit is contained in:
parent
035ad33b72
commit
550b9b58df
6 changed files with 28 additions and 0 deletions
|
@ -155,7 +155,9 @@ namespace NzbDrone.Core.Download
|
|||
throw;
|
||||
}
|
||||
|
||||
_logger.Trace("Downloaded {0} bytes from {1}", downloadedBytes.Length, link);
|
||||
_eventAggregator.PublishEvent(new IndexerDownloadEvent(indexerId, success, source, host, title, url.AbsoluteUri));
|
||||
|
||||
return downloadedBytes;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,6 +189,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||
if (request.Url.Scheme == "magnet")
|
||||
{
|
||||
ValidateMagnet(request.Url.FullUri);
|
||||
|
||||
return Encoding.UTF8.GetBytes(request.Url.FullUri);
|
||||
}
|
||||
|
||||
|
@ -233,6 +234,8 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||
throw;
|
||||
}
|
||||
|
||||
ValidateTorrent(downloadBytes);
|
||||
|
||||
return downloadBytes;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,6 +112,8 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
_logger.Error("Download failed");
|
||||
}
|
||||
|
||||
ValidateTorrent(downloadBytes);
|
||||
|
||||
return downloadBytes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,8 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
_logger.Error("Download failed");
|
||||
}
|
||||
|
||||
ValidateTorrent(downloadBytes);
|
||||
|
||||
return downloadBytes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
if (link.Scheme == "magnet")
|
||||
{
|
||||
ValidateMagnet(link.OriginalString);
|
||||
|
||||
return Encoding.UTF8.GetBytes(link.OriginalString);
|
||||
}
|
||||
|
||||
|
@ -164,6 +165,8 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
throw;
|
||||
}
|
||||
|
||||
ValidateTorrent(torrentData);
|
||||
|
||||
return torrentData;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue