Fixed: Failing dangerous and executable single file downloads

This commit is contained in:
Stevie Robinson 2025-01-26 03:29:07 +01:00 committed by GitHub
parent 103ccd74f3
commit e37684e045
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View file

@ -22,7 +22,7 @@ public class RejectedImportService : IRejectedImportService
public bool Process(TrackedDownload trackedDownload, ImportResult importResult)
{
if (importResult.Result != ImportResultType.Rejected || importResult.ImportDecision.LocalEpisode != null)
if (importResult.Result != ImportResultType.Rejected || importResult.ImportDecision.LocalEpisode == null)
{
return false;
}

View file

@ -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 with extension: {extension}")),
$"Caution: Found potentially dangerous file with extension: {extension}")
};
}
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 with extension: '{extension}'")),
$"Caution: Found executable file with extension: '{extension}'")
};
}
if (extension.IsNullOrWhiteSpace() || !MediaFileExtensions.Extensions.Contains(extension))
{
_logger.Debug("[{0}] has an unsupported extension: '{1}'", fileInfo.FullName, extension);