Destination background images: anonymous /destination-images MediaRoute from MinIO assets bucket #869

Closed
opened 2026-07-27 14:29:24 +00:00 by spikerj · 1 comment
Owner

Part of #868 (PR-1, backend).

Add to the MediaRoute table (SpikerSoft.Api/Extensions/ServiceCollectionExtensions.cs:~1136):

new MediaRoute("/destination-images", sp.GetRequiredKeyedService<IObjectStore>("assets"), "destinations", ServeUnknownTypes: false)

  • Extend MediaRoute/S3MediaFallbackMiddleware with an optional CacheControl field; set public, max-age=604800 here (images are immutable-by-name). Existing routes keep current behavior.
  • GET/HEAD only, 404 fail-soft, path hardening — all inherited from the middleware; add tests mirroring the existing middleware suite for the new prefix + cache header.
  • Serves objects Joey uploads to assets/destinations/{code}.avif (spec in #868).
Part of #868 (PR-1, backend). Add to the `MediaRoute` table (`SpikerSoft.Api/Extensions/ServiceCollectionExtensions.cs:~1136`): `new MediaRoute("/destination-images", sp.GetRequiredKeyedService<IObjectStore>("assets"), "destinations", ServeUnknownTypes: false)` - Extend `MediaRoute`/`S3MediaFallbackMiddleware` with an optional `CacheControl` field; set `public, max-age=604800` here (images are immutable-by-name). Existing routes keep current behavior. - GET/HEAD only, 404 fail-soft, path hardening — all inherited from the middleware; add tests mirroring the existing middleware suite for the new prefix + cache header. - Serves objects Joey uploads to `assets/destinations/{code}.avif` (spec in #868).
Author
Owner

Resolved in spikersoft-backend PR #497 (the consolidated family-card epic PR, merged to master, c8f692d7). The standalone PR #493 was closed unmerged in favour of that consolidation. Verified against origin/master:

  • S3MediaFallbackMiddleware.cs:13MediaRoute(..., string? CacheControl = null); header emitted at :83-85.
  • ServiceCollectionExtensions.cs:1153 — route registered against the keyed "assets" store with prefix destinations, ServeUnknownTypes: false, CacheControl: "public, max-age=604800".
  • Tests in S3MediaFallbackMiddlewareTests.cs: serves with the header (:201), no header on miss (:223), existing routes unchanged (:244), plus GET/HEAD, path-traversal and fail-soft coverage at :94, :171, :187.

Closing.

Resolved in spikersoft-backend PR #497 (the consolidated family-card epic PR, merged to `master`, `c8f692d7`). The standalone PR #493 was closed unmerged in favour of that consolidation. Verified against `origin/master`: - `S3MediaFallbackMiddleware.cs:13` — `MediaRoute(..., string? CacheControl = null)`; header emitted at `:83-85`. - `ServiceCollectionExtensions.cs:1153` — route registered against the keyed `"assets"` store with prefix `destinations`, `ServeUnknownTypes: false`, `CacheControl: "public, max-age=604800"`. - Tests in `S3MediaFallbackMiddlewareTests.cs`: serves with the header (`:201`), no header on miss (`:223`), existing routes unchanged (`:244`), plus GET/HEAD, path-traversal and fail-soft coverage at `:94`, `:171`, `:187`. Closing.
Sign in to join this conversation.