diff --git a/src/Prowlarr.Api.V1.Test/Indexers/NewznabControllerFixture.cs b/src/Prowlarr.Api.V1.Test/Indexers/NewznabControllerFixture.cs
new file mode 100644
index 000000000..34974476c
--- /dev/null
+++ b/src/Prowlarr.Api.V1.Test/Indexers/NewznabControllerFixture.cs
@@ -0,0 +1,18 @@
+using FluentAssertions;
+using Microsoft.AspNetCore.Http;
+using NUnit.Framework;
+using NzbDrone.Api.V1.Indexers;
+
+namespace Prowlarr.Api.V1.Test.Indexers
+{
+ public class NewznabControllerFixture
+ {
+ [TestCase("/api/v1/indexer/12/newznab", true)]
+ [TestCase("/12/api", false)]
+ [TestCase("/api/v1/indexer/12/download", false)]
+ public void should_only_allow_extended_search_parameters_on_prowlarr_newznab_route(string path, bool expected)
+ {
+ NewznabController.SupportsExtendedSearchParameters(new PathString(path)).Should().Be(expected);
+ }
+ }
+}
diff --git a/src/Prowlarr.Api.V1.Test/Prowlarr.Api.V1.Test.csproj b/src/Prowlarr.Api.V1.Test/Prowlarr.Api.V1.Test.csproj
index eec930286..72a865158 100644
--- a/src/Prowlarr.Api.V1.Test/Prowlarr.Api.V1.Test.csproj
+++ b/src/Prowlarr.Api.V1.Test/Prowlarr.Api.V1.Test.csproj
@@ -7,6 +7,7 @@
+
diff --git a/src/Prowlarr.Api.V1/AssemblyInfo.cs b/src/Prowlarr.Api.V1/AssemblyInfo.cs
new file mode 100644
index 000000000..59dc537b5
--- /dev/null
+++ b/src/Prowlarr.Api.V1/AssemblyInfo.cs
@@ -0,0 +1,3 @@
+using System.Runtime.CompilerServices;
+
+[assembly: InternalsVisibleTo("Prowlarr.Api.V1.Test")]
diff --git a/src/Prowlarr.Api.V1/Indexers/NewznabController.cs b/src/Prowlarr.Api.V1/Indexers/NewznabController.cs
index cde49b789..82b0b1353 100644
--- a/src/Prowlarr.Api.V1/Indexers/NewznabController.cs
+++ b/src/Prowlarr.Api.V1/Indexers/NewznabController.cs
@@ -58,6 +58,11 @@ public NewznabController(IndexerFactory indexerFactory,
[HttpGet("{id:int}/api")]
public async Task GetNewznabResponse(int id, [FromQuery] NewznabRequest request)
{
+ if (!SupportsExtendedSearchParameters(Request.Path))
+ {
+ request.searchMode = null;
+ }
+
var requestType = request.t;
request.source = Request.GetSource();
request.server = Request.GetServerUrl();
@@ -206,6 +211,12 @@ public async Task GetNewznabResponse(int id, [FromQuery] NewznabR
}
}
+ internal static bool SupportsExtendedSearchParameters(PathString path)
+ {
+ return path.Value?.StartsWith("/api/v1/indexer/", StringComparison.OrdinalIgnoreCase) == true &&
+ path.Value.EndsWith("/newznab", StringComparison.OrdinalIgnoreCase);
+ }
+
[HttpGet("/api/v1/indexer/{id:int}/download")]
[HttpGet("{id:int}/download")]
public async Task