Assess dangerous or executables also on processing single file

pull/7601/head
Stevie Robinson 3 months ago
parent 2ac139ab4d
commit 97de923d70

@ -260,6 +260,26 @@ namespace NzbDrone.Core.MediaFiles
var extension = Path.GetExtension(fileInfo.Name);
if (FileExtensions.DangerousExtensions.Contains(extension))
{
return new List<ImportResult>
{
new ImportResult(new ImportDecision(new LocalEpisode { Path = fileInfo.FullName },
new ImportRejection(ImportRejectionReason.DangerousFile, "Caution: Found potentially dangerous file")),
$"Caution: Found potentially dangerous file")
};
}
if (FileExtensions.ExecutableExtensions.Contains(extension))
{
return new List<ImportResult>
{
new ImportResult(new ImportDecision(new LocalEpisode { Path = fileInfo.FullName },
new ImportRejection(ImportRejectionReason.ExecutableFile, "Caution: Found executable file")),
$"Caution: Found executable file")
};
}
if (extension.IsNullOrWhiteSpace() || !MediaFileExtensions.Extensions.Contains(extension))
{
_logger.Debug("[{0}] has an unsupported extension: '{1}'", fileInfo.FullName, extension);

Loading…
Cancel
Save