1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-17 21:26:13 -04:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Mark McDowall
640e3e5d44 Bump version to 4.0.14 2025-03-15 09:43:34 -07:00
Mark McDowall
1260d3c800 Upgrade ImageSharp 2025-03-15 09:29:03 -07:00
v3DJG6GL
feeed9a7cf New: .arj and .lzh extensions are potentially dangerous 2025-03-15 09:25:40 -07:00
Mark McDowall
c8cb74a976 Fixed: Downloads failed for file contents will be removed from client 2025-03-08 19:59:13 -08:00
Stevie Robinson
7193acb5ee Fixed: Improve rejected download handling 2025-03-08 19:59:07 -08:00
Stevie Robinson
6f1fc1686f Fixed: Don't return warning in title field for rejected downloads
Closes #7663
2025-02-22 12:42:35 -08:00
Stevie Robinson
b7407837b7 Fixed: Rejected Imports with no associated release or indexer 2025-02-22 12:40:49 -08:00
5 changed files with 21 additions and 6 deletions

View File

@@ -22,7 +22,7 @@ env:
FRAMEWORK: net6.0 FRAMEWORK: net6.0
RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }} RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
SONARR_MAJOR_VERSION: 4 SONARR_MAJOR_VERSION: 4
VERSION: 4.0.13 VERSION: 4.0.14
jobs: jobs:
backend: backend:

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.MediaFiles.EpisodeImport; using NzbDrone.Core.MediaFiles.EpisodeImport;
@@ -14,15 +14,17 @@ public interface IRejectedImportService
public class RejectedImportService : IRejectedImportService public class RejectedImportService : IRejectedImportService
{ {
private readonly ICachedIndexerSettingsProvider _cachedIndexerSettingsProvider; private readonly ICachedIndexerSettingsProvider _cachedIndexerSettingsProvider;
private readonly Logger _logger;
public RejectedImportService(ICachedIndexerSettingsProvider cachedIndexerSettingsProvider) public RejectedImportService(ICachedIndexerSettingsProvider cachedIndexerSettingsProvider, Logger logger)
{ {
_cachedIndexerSettingsProvider = cachedIndexerSettingsProvider; _cachedIndexerSettingsProvider = cachedIndexerSettingsProvider;
_logger = logger;
} }
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 || trackedDownload.RemoteEpisode?.Release == null)
{ {
return false; return false;
} }
@@ -30,19 +32,27 @@ public class RejectedImportService : IRejectedImportService
var indexerSettings = _cachedIndexerSettingsProvider.GetSettings(trackedDownload.RemoteEpisode.Release.IndexerId); var indexerSettings = _cachedIndexerSettingsProvider.GetSettings(trackedDownload.RemoteEpisode.Release.IndexerId);
var rejectionReason = importResult.ImportDecision.Rejections.FirstOrDefault()?.Reason; var rejectionReason = importResult.ImportDecision.Rejections.FirstOrDefault()?.Reason;
if (indexerSettings == null)
{
trackedDownload.Warn(new TrackedDownloadStatusMessage(trackedDownload.DownloadItem.Title, importResult.Errors));
return true;
}
if (rejectionReason == ImportRejectionReason.DangerousFile && if (rejectionReason == ImportRejectionReason.DangerousFile &&
indexerSettings.FailDownloads.Contains(FailDownloads.PotentiallyDangerous)) indexerSettings.FailDownloads.Contains(FailDownloads.PotentiallyDangerous))
{ {
_logger.Trace("Download '{0}' contains potentially dangerous file, marking as failed", trackedDownload.DownloadItem.Title);
trackedDownload.Fail(); trackedDownload.Fail();
} }
else if (rejectionReason == ImportRejectionReason.ExecutableFile && else if (rejectionReason == ImportRejectionReason.ExecutableFile &&
indexerSettings.FailDownloads.Contains(FailDownloads.Executables)) indexerSettings.FailDownloads.Contains(FailDownloads.Executables))
{ {
_logger.Trace("Download '{0}' contains executable file, marking as failed", trackedDownload.DownloadItem.Title);
trackedDownload.Fail(); trackedDownload.Fail();
} }
else else
{ {
trackedDownload.Warn(new TrackedDownloadStatusMessage(importResult.Errors.First(), new List<string>())); trackedDownload.Warn(new TrackedDownloadStatusMessage(trackedDownload.DownloadItem.Title, importResult.Errors));
} }
return true; return true;

View File

@@ -40,6 +40,9 @@ namespace NzbDrone.Core.Download.TrackedDownloads
{ {
Status = TrackedDownloadStatus.Error; Status = TrackedDownloadStatus.Error;
State = TrackedDownloadState.FailedPending; State = TrackedDownloadState.FailedPending;
// Set CanBeRemoved to allow the failed item to be removed from the client
DownloadItem.CanBeRemoved = true;
} }
} }

View File

@@ -23,7 +23,9 @@ namespace NzbDrone.Core.MediaFiles
private static List<string> _dangerousExtensions = new List<string> private static List<string> _dangerousExtensions = new List<string>
{ {
".arj",
".lnk", ".lnk",
".lzh",
".ps1", ".ps1",
".scr", ".scr",
".vbs", ".vbs",

View File

@@ -20,7 +20,7 @@
<PackageReference Include="Servarr.FluentMigrator.Runner.SQLite" Version="3.3.2.9" /> <PackageReference Include="Servarr.FluentMigrator.Runner.SQLite" Version="3.3.2.9" />
<PackageReference Include="Servarr.FluentMigrator.Runner.Postgres" Version="3.3.2.9" /> <PackageReference Include="Servarr.FluentMigrator.Runner.Postgres" Version="3.3.2.9" />
<PackageReference Include="FluentValidation" Version="9.5.4" /> <PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.6" /> <PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.3.4" /> <PackageReference Include="NLog" Version="5.3.4" />
<PackageReference Include="MonoTorrent" Version="2.0.7" /> <PackageReference Include="MonoTorrent" Version="2.0.7" />