New: Validate NZBs before sending to download client

This commit is contained in:
Qstick
2017-11-25 22:55:50 -05:00
parent 5b7339cd73
commit 20dc8adac0
14 changed files with 357 additions and 5 deletions
@@ -16,15 +16,18 @@ namespace NzbDrone.Core.Download
where TSettings : IProviderConfig, new()
{
protected readonly IHttpClient _httpClient;
private readonly IValidateNzbs _nzbValidationService;
protected UsenetClientBase(IHttpClient httpClient,
IConfigService configService,
IDiskProvider diskProvider,
IRemotePathMappingService remotePathMappingService,
IValidateNzbs nzbValidationService,
Logger logger)
: base(configService, diskProvider, remotePathMappingService, logger)
{
_httpClient = httpClient;
_nzbValidationService = nzbValidationService;
}
public override DownloadProtocol Protocol => DownloadProtocol.Usenet;
@@ -70,6 +73,8 @@ namespace NzbDrone.Core.Download
throw new ReleaseDownloadException(remoteAlbum.Release, "Downloading nzb failed", ex);
}
_nzbValidationService.Validate(filename, nzbData);
_logger.Info("Adding report [{0}] to the queue.", remoteAlbum.Release.Title);
return AddFromNzbFile(remoteAlbum, filename, nzbData);
}