fix: CMS image proxy + partial unique index for soft-deleted releases

This commit is contained in:
daniel-c-harvey
2026-06-12 06:27:34 -04:00
parent dd30d57838
commit 0448711082
10 changed files with 310 additions and 52 deletions
@@ -1,6 +1,5 @@
@using DeepDrftModels.Enums
@using Microsoft.AspNetCore.Components.Forms
@inject IHttpClientFactory HttpClientFactory
<MudPaper Class="pa-6 mb-4" Elevation="2">
<MudGrid>
@@ -93,19 +92,11 @@
[Parameter] public bool Disabled { get; set; }
// The image endpoint (GET api/image/{entryKey}) is unauthenticated, so the browser hits
// DeepDrftAPI directly. Base address comes from the same named client the CMS uses.
private string? ExistingImagePreviewUrl
{
get
{
if (string.IsNullOrEmpty(ExistingImagePath)) return null;
var baseAddress = HttpClientFactory.CreateClient("DeepDrft.Content.Cms").BaseAddress;
return baseAddress is null
? null
: new Uri(baseAddress, $"api/image/{Uri.EscapeDataString(ExistingImagePath)}").ToString();
}
}
// Relative path — resolves against the Manager's own origin, proxied by ImageProxyController.
private string? ExistingImagePreviewUrl =>
string.IsNullOrEmpty(ExistingImagePath)
? null
: $"/api/image/{Uri.EscapeDataString(ExistingImagePath)}";
private Task HandleImageFileSelected(InputFileChangeEventArgs e) =>
SelectedImageFileChanged.InvokeAsync(e.File);