mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-04-24 06:17:08 -04:00
Fixed: Failing dangerous and executable single file downloads
This commit is contained in:
parent
103ccd74f3
commit
e37684e045
2 changed files with 21 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue