Fixed: (Apps) Use forceSave=true to avoid validation warnings

This commit is contained in:
Bogdan
2023-06-25 10:29:38 +03:00
parent 8fcceb0702
commit 06391489cf
5 changed files with 70 additions and 20 deletions

View File

@@ -86,13 +86,23 @@ namespace NzbDrone.Core.Applications.Radarr
request.SetContent(indexer.ToJson());
return ExecuteIndexerRequest(request);
try
{
return ExecuteIndexerRequest(request);
}
catch (HttpException ex) when (ex.Response.StatusCode == HttpStatusCode.BadRequest)
{
request.Url = request.Url.AddQueryParam("forceSave", "true");
return ExecuteIndexerRequest(request);
}
}
public RadarrIndexer UpdateIndexer(RadarrIndexer indexer, RadarrSettings settings)
{
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
request.Url = request.Url.AddQueryParam("forceSave", "true");
request.SetContent(indexer.ToJson());
return ExecuteIndexerRequest(request);
@@ -192,8 +202,10 @@ namespace NzbDrone.Core.Applications.Radarr
break;
default:
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
throw;
break;
}
throw;
}
catch (JsonReaderException ex)
{
@@ -205,8 +217,6 @@ namespace NzbDrone.Core.Applications.Radarr
_logger.Error(ex, "Unable to add or update indexer");
throw;
}
return null;
}
private HttpRequest BuildRequest(RadarrSettings settings, string resource, HttpMethod method)