Fix registry search 500: handle non-JSON Harbor fixture response
Harbor fixture returns plain text, not JSON. The RegistrySearchEndpoints deserialization crashed with an unhandled JsonException causing 500 on every /api/v1/registries/images/search request. This blocked the release creation wizard at Step 2 (Components). Fix: catch JsonException and return empty results gracefully. The release wizard now shows "no results" instead of silently failing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,17 @@ public static class RegistrySearchEndpoints
|
||||
RegistryId = "harbor-fixture"
|
||||
});
|
||||
}
|
||||
catch (JsonException jex)
|
||||
{
|
||||
logger.LogWarning(jex, "Harbor returned non-JSON response for query '{Query}'", query);
|
||||
|
||||
return Results.Ok(new RegistrySearchResponse
|
||||
{
|
||||
Items = [],
|
||||
TotalCount = 0,
|
||||
RegistryId = "harbor-fixture"
|
||||
});
|
||||
}
|
||||
catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException or OperationCanceledException)
|
||||
{
|
||||
logger.LogWarning(ex, "Harbor registry unreachable during image search for query '{Query}'", query);
|
||||
|
||||
Reference in New Issue
Block a user