Fixed: Don't process files that don't have a supported media file extension (#2938)

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

(cherry picked from commit 1977f4aa3c55cc0a06e1958e611f366d56cc346e)

* fixup!

* fixup!

Co-authored-by: Mark McDowall <mark@mcdowall.ca>
Co-authored-by: Qstick <qstick@gmail.com>
pull/2965/head
servarr[bot] 2 years ago committed by GitHub
parent b3b93db643
commit d27d982120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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<ImportResult>
{
new ImportResult(new ImportDecision<LocalTrack>(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))

Loading…
Cancel
Save