From df53c980d1c76a54aac217c44ead3c52356502ea Mon Sep 17 00:00:00 2001 From: nitrobass24 Date: Mon, 6 Apr 2026 23:45:02 -0500 Subject: [PATCH] Improve URL matching and handle 404 on indexer removal - Use path-boundary check in GetIndexerMappings to prevent prefix false matches on ProwlarrUrl - Treat 404 as success in RemoveIndexer so local cleanup proceeds when the remote indexer is already gone Co-Authored-By: Claude Opus 4.6 (1M context) --- src/NzbDrone.Core/Applications/Qui/Qui.cs | 6 +++++- src/NzbDrone.Core/Applications/Qui/QuiProxy.cs | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Applications/Qui/Qui.cs b/src/NzbDrone.Core/Applications/Qui/Qui.cs index 99a8c7b22..1113960d0 100644 --- a/src/NzbDrone.Core/Applications/Qui/Qui.cs +++ b/src/NzbDrone.Core/Applications/Qui/Qui.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using FluentValidation.Results; @@ -39,8 +40,11 @@ public override List GetIndexerMappings() foreach (var indexer in indexers) { + var baseUrl = Settings.ProwlarrUrl.TrimEnd('/'); + if (indexer.Backend == "prowlarr" && - indexer.BaseUrl?.TrimEnd('/').StartsWith(Settings.ProwlarrUrl.TrimEnd('/')) == true && + (indexer.BaseUrl?.TrimEnd('/').Equals(baseUrl, StringComparison.OrdinalIgnoreCase) == true || + indexer.BaseUrl?.StartsWith(baseUrl + "/", StringComparison.OrdinalIgnoreCase) == true) && indexer.ApiKey == _configFileProvider.ApiKey && int.TryParse(indexer.IndexerId, out var indexerId)) { diff --git a/src/NzbDrone.Core/Applications/Qui/QuiProxy.cs b/src/NzbDrone.Core/Applications/Qui/QuiProxy.cs index be0f9bc69..9e455a97f 100644 --- a/src/NzbDrone.Core/Applications/Qui/QuiProxy.cs +++ b/src/NzbDrone.Core/Applications/Qui/QuiProxy.cs @@ -84,6 +84,11 @@ public void RemoveIndexer(int indexerId, QuiSettings settings) var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexerId}", HttpMethod.Delete); var response = _httpClient.Execute(request); + if (response.StatusCode == HttpStatusCode.NotFound) + { + return; + } + if ((int)response.StatusCode >= 300) { throw new HttpException(response);