H3: mediaopslag in een map buiten de release, /media-endpoint (immutable, 404 voor al het andere), mapcontrole en snelheidsbeleid
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# H3 Media store and serving: code summary
|
||||
|
||||
Built 2026-11-16. Core tests green (Core.Tests, Media area 115 tests; the whole Core suite passes).
|
||||
|
||||
| Area | What |
|
||||
|---|---|
|
||||
| Store | `IMediaStore` and `FileSystemMediaStore` (`Core/Media/MediaStore.cs`): atomic set writes (temp directory, then one move; a failed write leaves nothing visible), plain file writes for originals, strict key allow-list (segments of lower-case letters, digits, dot, underscore and dash; at most four; the result must stay inside the root), list and delete of sets, total bytes, free space, writable probe. A database store can replace it later |
|
||||
| Serving | `MediaEndpoint.MapCmsMedia` (`GET` and `HEAD /media/{**path}`): anonymous and marked as a public-site endpoint, rate-limit policy `media-public`, only addresses of the exact scheme in a registered area, immutable cache header, strong ETag and 304, `nosniff`; every other case is the same empty 404; originals are never reachable |
|
||||
| Registration | `AddCmsMedia` (options bound from `Media:*`, store, gate, status, guard, self-test and directory check) and `AddCmsMediaArea("hero")`; `MediaDirectoryCheck` probes the directory at start-up (uploads off when missing or not writable) and warns above 80 percent of `Media:MaxTotalBytes`; wired into `CmsHost` (after `MapControllers`) |
|
||||
| Rate limits | policies `hero-public` (120 per 60 s), `media-public` (600 per 60 s) and `hero-upload` (20 per hour per signed-in user) added next to `offerings-public` |
|
||||
| Tests | store (atomicity, traversal and bad keys, replace, list, count, probe, free space), endpoint (headers, avif type, 304, HEAD, ten kinds of 404 including encoded traversal, method not allowed, no endpoint without a registered area), directory check |
|
||||
|
||||
Not in this unit: the retire-and-clean-up service (needs the Hero tables, built with H2), the free-space and total-size checks at upload time (H2, `HeroImageService`).
|
||||
Reference in New Issue
Block a user