mirror of
https://github.com/Sonarr/Sonarr
synced 2025-12-06 08:28:37 +01: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 RejectedImportService(ICachedIndexerSettingsProvider cachedIndexerSetting
|
||||||
|
|
||||||
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 @@ private List<ImportResult> ProcessFile(FileInfo fileInfo, ImportMode importMode,
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue