mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-05 13:20:20 -05:00
Fixed: Failing dangerous and executable single file downloads
This commit is contained in:
@@ -22,7 +22,7 @@ public class RejectedImportService : IRejectedImportService
|
|||||||
|
|
||||||
public bool Process(TrackedDownload trackedDownload, ImportResult importResult)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,6 +260,26 @@ namespace NzbDrone.Core.MediaFiles
|
|||||||
|
|
||||||
var extension = Path.GetExtension(fileInfo.Name);
|
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))
|
if (extension.IsNullOrWhiteSpace() || !MediaFileExtensions.Extensions.Contains(extension))
|
||||||
{
|
{
|
||||||
_logger.Debug("[{0}] has an unsupported extension: '{1}'", fileInfo.FullName, extension);
|
_logger.Debug("[{0}] has an unsupported extension: '{1}'", fileInfo.FullName, extension);
|
||||||
|
|||||||
Reference in New Issue
Block a user