diff --git a/src/NzbDrone.Core/MediaFiles/DownloadedTracksImportService.cs b/src/NzbDrone.Core/MediaFiles/DownloadedTracksImportService.cs index 32c00b908..d26cf0525 100644 --- a/src/NzbDrone.Core/MediaFiles/DownloadedTracksImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/DownloadedTracksImportService.cs @@ -6,6 +6,7 @@ using System.Linq; using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Common.Extensions; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Download; using NzbDrone.Core.MediaFiles.Events; @@ -276,6 +277,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 + { + new ImportResult(new ImportDecision(new LocalTrack { Path = fileInfo.FullName }, + new Rejection($"Invalid audio file, unsupported extension: '{extension}'")), + $"Invalid audio file, unsupported extension: '{extension}'") + }; + } + if (downloadClientItem == null) { if (_diskProvider.IsFileLocked(fileInfo.FullName))