Fixed: Don't process files that don't have a supported media file extension

This commit is contained in:
Mark McDowall 2022-08-07 13:26:22 -07:00
parent d0efdc6c62
commit 1977f4aa3c
2 changed files with 16 additions and 1 deletions

View File

@ -5,6 +5,7 @@ using System.Linq;
using NLog; using NLog;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.MediaFiles.EpisodeImport; using NzbDrone.Core.MediaFiles.EpisodeImport;
@ -243,6 +244,20 @@ namespace NzbDrone.Core.MediaFiles
}; };
} }
var extension = Path.GetExtension(fileInfo.Name);
if (extension.IsNullOrWhiteSpace() || !MediaFileExtensions.Extensions.Contains(extension))
{
_logger.Debug("[{0}] has an unsupported extension: '{1}'", fileInfo.FullName, extension);
return new List<ImportResult>
{
new ImportResult(new ImportDecision(new LocalEpisode { Path = fileInfo.FullName },
new Rejection($"Invalid video file, unsupported extension: '{extension}'")),
$"Invalid video file, unsupported extension: '{extension}'")
};
}
if (downloadClientItem == null) if (downloadClientItem == null)
{ {
if (_diskProvider.IsFileLocked(fileInfo.FullName)) if (_diskProvider.IsFileLocked(fileInfo.FullName))

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;