mirror of
https://github.com/Lidarr/Lidarr
synced 2026-05-03 01:51:24 +02:00
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>
This commit is contained in:
parent
b3b93db643
commit
d27d982120
1 changed files with 15 additions and 0 deletions
|
|
@ -6,6 +6,7 @@
|
|||
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 @@ private List<ImportResult> ProcessFile(IFileInfo fileInfo, ImportMode importMode
|
|||
};
|
||||
}
|
||||
|
||||
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…
Reference in a new issue