mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-05-07 12:10:20 +02:00
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) <noreply@anthropic.com>
This commit is contained in:
parent
6ef78c169a
commit
df53c980d1
2 changed files with 10 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation.Results;
|
||||
|
|
@ -39,8 +40,11 @@ public override List<AppIndexerMap> 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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue